I have a question regarding the knitr chunk option "dependson". As far as I understood the manual this option should be used to specify which other cached chunks a cached chunk depends on. But is there a way to invalidate a chunk's cache when an uncached chunk changes?
Here's a minimal example:
File knitrtest.Rnw:
\documentclass{article}
\begin{document}
<<>>=
library(knitr)
read_chunk("chunks.R")
@
<<not_cached>>=
@
<<cached, cache=TRUE, dependson="not_cached">>=
@
\end{document}
File chunks.R:
## @knitr not_cached
var <- 42
## @knitr cached
var
When I change var the output from chunk "cached" is still 42 as the dependson option doesn't apply.
In my example I could solve the problem by caching the first chunk, too. However, I cannot do that because in the first chunk I use library()
and read in external files, so this chunk should not be cached.
Is there a way to invalidate cache when a not cached chunk changes?