Different cache levels

# Work around issue #645 in knitr
library(methods)

cache=FALSE or cache=0 means no cache:

Sys.sleep(1)
1 + 1
plot(cars)

cache=1 means to save the results from evaluate::evaluate(), and pretend the code has been evaluated; all the output hooks will be applied every time the document is recompiled; note the plots are also saved as display lists, and will be redrawn every time the document is recompiled:


cache=2 is similar to cache=1, and the only difference is that the plots will not be redrawn, in which case you need to make sure you did not delete the figure files manually:


cache=TRUE or cache=3 means to cache the text output of a chunk; none of the output hooks will be called when the document is recompiled, and the plots will not be redrawn, either:


Below is a test case for #588:

pairs(matrix(rnorm(100), ncol=100), labels=1:100, pch='.')

Another test case, with more plots:

Sys.sleep(5)
plot(1:10)
abline(0, 1)
plot(2:11)


Try the parsermd package in your browser

Any scripts or data that you put into this service are public.

parsermd documentation built on May 20, 2021, 5:08 p.m.