[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] Variable in file name for babel output?
From: |
Andreas Leha |
Subject: |
Re: [O] Variable in file name for babel output? |
Date: |
Fri, 28 Jun 2013 01:07:54 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) |
Hi Loris,
"Loris Bennett" <address@hidden> 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