* [BUG] [babel] R graphics header arg :units
@ 2012-06-17 20:19 Andreas Leha
2012-06-17 22:06 ` Thomas S. Dye
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Andreas Leha @ 2012-06-17 20:19 UTC (permalink / raw)
To: emacs-orgmode
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
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [BUG] [babel] R graphics header arg :units
2012-06-17 20:19 [BUG] [babel] R graphics header arg :units Andreas Leha
@ 2012-06-17 22:06 ` Thomas S. Dye
2012-06-17 23:05 ` Myles English
2012-06-19 3:36 ` [PATCH] " Thomas S. Dye
2 siblings, 0 replies; 7+ messages in thread
From: Thomas S. Dye @ 2012-06-17 22:06 UTC (permalink / raw)
To: Andreas Leha; +Cc: emacs-orgmode
Hi Andreas,
I believe the author of ob-R.el no longer reads the list. Perhaps you could
propose a patch?
All the best,
Tom
Andreas Leha <andreas.leha@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
>
>
>
--
Thomas S. Dye
http://www.tsdye.com
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [BUG] [babel] R graphics header arg :units
2012-06-17 20:19 [BUG] [babel] R graphics header arg :units Andreas Leha
2012-06-17 22:06 ` Thomas S. Dye
@ 2012-06-17 23:05 ` Myles English
2012-06-18 6:48 ` Andreas Leha
2012-06-19 3:36 ` [PATCH] " Thomas S. Dye
2 siblings, 1 reply; 7+ messages in thread
From: Myles English @ 2012-06-17 23:05 UTC (permalink / raw)
To: Andreas Leha; +Cc: emacs-orgmode Mode
Hi Andreas,
>> On Sun, 17 Jun 2012 22:19:39 +0200, Andreas Leha said:
> 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
It seems to work if you do this :units "'cm'" :res 100, i.e.:
#+begin_src R :results graphics :file wideplot.png :width 14 :height 7 :units "'cm'" :res 100
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?
I can't comment on whether it is a bug or not.
> Regards,
> Andreas
--
Myles
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [BUG] [babel] R graphics header arg :units
2012-06-17 23:05 ` Myles English
@ 2012-06-18 6:48 ` Andreas Leha
0 siblings, 0 replies; 7+ messages in thread
From: Andreas Leha @ 2012-06-18 6:48 UTC (permalink / raw)
To: emacs-orgmode
Hi Myles,
> Hi Andreas,
>
>>> On Sun, 17 Jun 2012 22:19:39 +0200, Andreas Leha said:
>
> > 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
>
> It seems to work if you do this :units "'cm'" :res 100, i.e.:
>
> #+begin_src R :results graphics :file wideplot.png :width 14 :height 7 :units "'cm'" :res 100
> plot(1:10, 1:10)
> #+end_src
>
Thanks for this! I had only tried :units '"cm"'... Your example works
fine here.
Best,
Andreas
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH] Re: [BUG] [babel] R graphics header arg :units
2012-06-17 20:19 [BUG] [babel] R graphics header arg :units Andreas Leha
2012-06-17 22:06 ` Thomas S. Dye
2012-06-17 23:05 ` Myles English
@ 2012-06-19 3:36 ` Thomas S. Dye
2012-06-19 7:05 ` Andreas Leha
2012-06-19 13:26 ` Eric Schulte
2 siblings, 2 replies; 7+ messages in thread
From: Thomas S. Dye @ 2012-06-19 3:36 UTC (permalink / raw)
To: Andreas Leha; +Cc: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 1015 bytes --]
Andreas Leha <andreas.leha@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
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Patch for ob-R.el --]
[-- Type: text/x-patch, Size: 705 bytes --]
From b8aa7b26f56300faadd1a40433208ef18db8ae73 Mon Sep 17 00:00:00 2001
From: Thomas Dye <tsd@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
[-- Attachment #3: Type: text/plain, Size: 40 bytes --]
--
Thomas S. Dye
http://www.tsdye.com
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] Re: [BUG] [babel] R graphics header arg :units
2012-06-19 3:36 ` [PATCH] " Thomas S. Dye
@ 2012-06-19 7:05 ` Andreas Leha
2012-06-19 13:26 ` Eric Schulte
1 sibling, 0 replies; 7+ messages in thread
From: Andreas Leha @ 2012-06-19 7:05 UTC (permalink / raw)
To: emacs-orgmode
tsd@tsdye.com (Thomas S. Dye) writes:
> Andreas Leha <andreas.leha@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
Hi Tom,
very nice. With your patch I can confirm the :units argument accepts
quoted strings!
Thanks a lot,
Andreas
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] Re: [BUG] [babel] R graphics header arg :units
2012-06-19 3:36 ` [PATCH] " Thomas S. Dye
2012-06-19 7:05 ` Andreas Leha
@ 2012-06-19 13:26 ` Eric Schulte
1 sibling, 0 replies; 7+ messages in thread
From: Eric Schulte @ 2012-06-19 13:26 UTC (permalink / raw)
To: Thomas S. Dye; +Cc: Andreas Leha, emacs-orgmode
tsd@tsdye.com (Thomas S. Dye) writes:
> Andreas Leha <andreas.leha@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
Applied, Thanks Tom
--
Eric Schulte
http://cs.unm.edu/~eschulte
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2012-06-19 13:27 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-06-17 20:19 [BUG] [babel] R graphics header arg :units Andreas Leha
2012-06-17 22:06 ` Thomas S. Dye
2012-06-17 23:05 ` Myles English
2012-06-18 6:48 ` Andreas Leha
2012-06-19 3:36 ` [PATCH] " Thomas S. Dye
2012-06-19 7:05 ` Andreas Leha
2012-06-19 13:26 ` Eric Schulte
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).