emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Efficiently reuse code in org babel with R


From: Naresh Gurbuxani
Subject: Efficiently reuse code in org babel with R
Date: Thu, 7 Jul 2022 03:31:20 +0000

I want to source some data from databases, then use this data in various 
blocks.  I am looking for the most efficient way to achieve this.  In below 
blocks, is the code in block ``connection'' executed thrice (economy of code 
but no saving of time) or is it only executed once then used twice?  If the 
code is run thrice, is there another way to create code blocks so that the code 
is executed only once?

Thanks,
Naresh

#+name: connection
#+begin_src R :exports results :results output
  ## my code here
#+end_src

#+begin_src R :exports results :results output graphics file :file 
figures/fig1.png
<<connection>>
## my code here
#+end_src

#+begin_src R :exports results output graphics file :file figures/fig2.png
<<connection>>
## my code here
#+end_src


reply via email to

[Prev in Thread] Current Thread [Next in Thread]