Andreas Leha <andreas.l...@med.uni-goettingen.de> writes: > Hi all, > > I am having troubles in using the header argument :units which is > implemented for R source blocks. Example: > > #+begin_src R :results graphics :file wideplot.png :width 14 :height 7 :units > "cm" > plot(1:10, 1:10) > #+end_src > > > This expands to > > : png(filename="wideplot.png",height=7,units=cm,width=14) > : plot(1:10, 1:10) > : dev.off() > > and leads -- when evaluated -- to the error > > : Fehler in match.arg(units, c("in", "px", "cm", "mm")) : > : 'arg' must be NULL or a character vector > > I guess this is a bug, correct? Otherwise, how do I correctly use > this header argument? > > Regards, > Andreas > > >
Aloha all, The attached patch handles quoted string values for R device header arguments. With the patch the following works as expected: #+header: :width 100 :height 100 :units "mm" :res 120 #+BEGIN_SRC R :results graphics :file "test.png" x <- c(1,2,3,4,5) y <- x plot(x,y) #+END_SRC All the best, Tom
>From b8aa7b26f56300faadd1a40433208ef18db8ae73 Mon Sep 17 00:00:00 2001 From: Thomas Dye <t...@tsdye.com> Date: Mon, 18 Jun 2012 17:26:09 -1000 Subject: [PATCH] * lisp/ob-R.el: Handle quoted string values to device header arguments --- lisp/ob-R.el | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/lisp/ob-R.el b/lisp/ob-R.el index d23f269..0802736 100644 --- a/lisp/ob-R.el +++ b/lisp/ob-R.el @@ -260,7 +260,7 @@ current code buffer." (setq args (mapconcat (lambda (pair) (if (member (car pair) allowed-args) - (format ",%s=%s" + (format ",%s=%S" (substring (symbol-name (car pair)) 1) (cdr pair)) "")) params "")) -- 1.7.5.4
-- Thomas S. Dye http://www.tsdye.com