How to cache knitr chunks across two (or more) files?
问题 I want to use some R-Code in two different *.Rnw files and want to use caching across those files. I read http://yihui.name/knitr/demo/externalization/ Caching in one file just works fine. But running the second one the whole code is executed again: plain.R ## @knitr random1 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')