emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Efficiently reuse code in org babel with R
@ 2022-07-07  3:31 Naresh Gurbuxani
  2022-07-07  4:15 ` Vikas Rawal
  2022-07-07  6:22 ` Greg Minshall
  0 siblings, 2 replies; 5+ messages in thread
From: Naresh Gurbuxani @ 2022-07-07  3:31 UTC (permalink / raw)
  To: emacs-orgmode@gnu.org

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-07-07 12:12 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-07-07  3:31 Efficiently reuse code in org babel with R Naresh Gurbuxani
2022-07-07  4:15 ` Vikas Rawal
2022-07-07  8:42   ` Jeremie Juste
2022-07-07 12:09     ` Naresh Gurbuxani
2022-07-07  6:22 ` Greg Minshall

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).