I have an file which is a research paper (here); it contains numerous R blocks which produce tables and figures. Since these share common data and preliminary calculations, they are run as a org-babel session.
However, some of these tables and figures are reasonably time-consuming (a few seconds each), such that export becomes a somewhat lengthy proposition. A lot of the time at the end I am not changing the figures at all, just making minor amendments and corrections to the text, yet each re-render still takes a long time.
Caching is what I would seem to want, but the org mode manual address this specifically:
Note that the :cache header argument will not attempt to cache results when the :session header argument is used, because the results of the code block execution may be stored in the session outside of the Org mode buffer.
My question is - what does the second half of this sentence mean? Is this "may be stored" as in "might be stored" (so babel shouldn't) or as in "can be stored" (so babel needn't). Does anyone know if there's a technical org-internal reason that caching won't work with session?
And above all - any solutions to caching long-ish R operations when using org-babel? And ideally, without writing a lot of unnatural code in the R blocks. I already do some thigns like
if ( ! exists(foo) ) foo <- read.delim(...) to avoid repeating the longest data-loading operations but this can be a bit error prone and muddies the R code.