Description Usage Details Value Note Author(s) See Also Examples
Cache computations when using Sweave
1 2 |
Computations in Sweave documents can be cached by setting the option
cache=true
in the code check declaration. When this option is
set, objects that are created in the code chunk (either through
assignment or by side effects) are stored in a key-value database in
the directory specified by setCacheDir
.
Caching and dependencies is implemented by storing chunks modification
time in a metadata database. To use dependencies label your dependencies
and refer to them using the syntax dependson=A;B
. See example.
You can add trace information to your output file using the option
trace=true
. This will show the modification times of the chunks
and whether cached or newly evaluated chunks are being used.
The cacheSweaveDriver
function is used directly with
Sweave
and is passed as the driver
argument.
For tangling the cacheTangleDriver
needs to be used if you
have dependencies in your source file.
Nothing useful is returned.
Code chunks that have side effects that do not result in objects being created in the global environment (i.e. plotting or system interaction) should generally not be cached since the code will not be run upon reevaluation.
Roger D. Peng rpeng@jhsph.edu, with much code for
cacheSweaveDriver
copied from Sweave source by Friedrich Leisch
1 2 3 4 5 6 7 8 9 10 11 12 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.