Rainer M Krug <r.m.k...@gmail.com> writes: > Hi > > I do the following to create a graph in R and then convert / copy / do other > stuff with it in the > bash shell: > > #+header: :results graphics > #+header: :file Test.pdf > #+header: :width 4 > #+header: :height 8 > #+header: :pointsize 8 > #+begin_src R > plot(runif(100)) > #+end_src > > #+BEGIN_SRC sh :session shell > cp Test.pdf Test2.pdf > #+END_SRC > > > Is there a way of automatically giving the ffile name from the :file > parameter tio the second code > block, so that I just have to change the :file argument when I want a > different name for the graph? > > Thanks, > > Rainer
Hi Rainer, I am not aware of any possibility to pass the :file parameter from one code block to another. But for your use case, the file name is also the return value of the R code block. So, you can do: #+name: mypdfplot #+header: :results graphics #+header: :file Test.pdf #+header: :width 4 #+header: :height 8 #+header: :pointsize 8 #+begin_src R plot(runif(100)) #+end_src #+BEGIN_SRC sh :session shell :var mypdf=mypdfplot() cp "$mypdf" Test2.pdf #+END_SRC Best, Andreas