From: Andreas Leha <andreas.leha@med.uni-goettingen.de>
To: emacs-orgmode@gnu.org
Subject: Re: Variable in file name for babel output?
Date: Fri, 28 Jun 2013 01:07:54 +0200 [thread overview]
Message-ID: <8761wzi245.fsf@med.uni-goettingen.de> (raw)
In-Reply-To: 87y59vr9ve.fsf@hornfels.zedat.fu-berlin.de
Hi Loris,
"Loris Bennett" <loris.bennett@fu-berlin.de> writes:
> Hi,
>
> Is it possible to pass a variable to a source block such that the
> variable can be used as part of the name of the output file?
>
> Currently I have
>
> #+HEADER: :var data=timelimit-elapsed-data year=2011 :colnames yes
> #+HEADER: :session *r* :file (org-babel-temp-file "time-elapsed-" ".pdf")
>
> which gets me a different name for each value of 'year', but ideally I
> would like the files to be called
>
> time-elapsed-2011.pdf
> time-elapsed-2012.pdf
> time-elapsed-2013.pdf
>
> etc.
>
> Can this be done?
Maybe not what you are looking for, but you could handle the assembly of
the filename within your code block.
Something like:
#+HEADER: :var year=2011 :session *r* :results file
#+begin_src R
filename <- paste0("time-elapsed-", year, ".pdf")
pdf(filename)
## your code
dev.off()
filename
#+end_src
Regards,
Andreas
next prev parent reply other threads:[~2013-06-27 23:08 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-27 12:55 Variable in file name for babel output? Loris Bennett
2013-06-27 23:07 ` Andreas Leha [this message]
2013-06-28 6:21 ` Loris Bennett
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
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8761wzi245.fsf@med.uni-goettingen.de \
--to=andreas.leha@med.uni-goettingen.de \
--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 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).