yihui/knitr — Issue #112: cached chunk not loaded on later run
Author: jacktanner
Created: 2012-01-25 21:20:25+00:00
State: open

I've got a doc of two chunks, c1 and c2.

<>
library(ggplot2)
@
<>
qplot(rnorm(100))
@

This generates a PDF correctly. Note that c1 is cached. Now, I add a third chunk to the same document (or equivalently, modify c2), and run again:

<>
qplot(runif(100))
@

I get

## Error: could not find function "qplot"

It seems that c1 is cached and not modified between the first and the second run, therefore knitr doesn't try to load it and ggplot2 is not in the environment when c3 is executed.