I want to use some R code in two different * .Rnw files and want to use caching through these files. I read http://yihui.name/knitr/demo/externalization/
Caching in a single file just works fine. But running the second one, all the code will be executed again:
plain.R
a <- rnorm(10)
a
doc1.Rnw (and doc2.Rnw)
\documentclass{article}
<<set-options, echo=FALSE, cache=FALSE>>=
options(replace.assign=TRUE)
opts_chunk$set(external=TRUE, cache=TRUE, echo=FALSE, fig=TRUE)
read_chunk('plain.R')
@
\title{Doc 1}
\begin{document}
<<random1>>=
@
\end{document}
Is there a way to share the cache between multiple documents?
source
share