dep_auto {knitr}R Documentation

Build automatic dependencies among chunks


When the chunk option autodep = TRUE, all names of objects created in a chunk will be saved in a file named ‘__objects’ and all global objects used in a chunk will be saved to ‘__globals’. This function can analyze object names in these files to automatically build cache dependencies, which is similar to the effect of the dependson option. It is supposed to be used in the first chunk of a document and this chunk must not be cached.


dep_auto(path = opts_chunk$get("cache.path"))



Path to the dependency file.


NULL. The dependencies are built as a side effect.


Be cautious about path: because this function is used in a chunk, the working directory when the chunk is evaluated is the directory of the input document in knit, and if that directory differs from the working directory before calling knit(), you need to adjust the path argument here to make sure this function can find the cache files ‘__objects’ and ‘__globals’.


See Also


[Package knitr version 1.18.10 Index]