From: Myles English <mylesenglish@gmail.com>
To: emacs-orgmode@gnu.org
Subject: sbe with :file header arg?
Date: Fri, 07 Oct 2011 18:49:34 +0100 [thread overview]
Message-ID: <87r52oy9n5.fsf@bill.home> (raw)
Hello,
I think I have one case of strange behaviour and one feature request, if it
isn't already possible.
I would like to make one plot per row of a table. This is useful because the
contents of the row may be parameters in an R session, and a link to the
resulting plot can be put in the last cell of each row.
The following source block makes a plot:
#+source: plotTest
#+headers: :var A="A" :var B="B" :var C="C"
#+begin_src R :file nofile.png :results graphics :session b
plot( 1,1, ylab=A, xlab=B)
text(0.8,0.8,C)
#+end_src
#+results: plotTest
[[file:nofile.png]]
and the source block may be called using this table:
#+TBLNAME: testtbl
| "5" | "X" | "Y" | nofile.png |
| 7 | P | "Q" | nofile.png |
#+TBLFM: $4='(sbe plotTest (A $1)(B $2)(C $3))
executing that shows up the strange behaviour because the R interpreter
contains:
> > png(filename="nofile.png")
> A <- "5"
> B <- "X"
> C <- "Y"
> plot( 1,1, ylab=A, xlab=B)
> text(0.8,0.8,C)
> dev.off()
null device
1
> > png(filename="nofile.png")
> A <- 7
> B <- "/home/myles/org/org/nofile.png" <------ STRANGE, NO?
> C <- "Q"
> plot( 1,1, ylab=A, xlab=B)
> text(0.8,0.8,C)
> dev.off()
null device
1
Now the feature request; would it be possible to pass a :file header
based on a value in the table, like this?
#+TBLNAME:testtwo
| a.png | "G" | "E" | "F" | [[img/a.png]] |
#+TBLFM: $4='(sbe plotTest[:file img/$1] (A $2)(B $3)(C $4))
Thanks,
Myles
next reply other threads:[~2011-10-07 17:48 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-07 17:49 Myles English [this message]
2011-10-07 18:22 ` sbe with :file header arg? Eric Schulte
2011-10-10 12:15 ` Myles English
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87r52oy9n5.fsf@bill.home \
--to=mylesenglish@gmail.com \
--cc=emacs-orgmode@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.