This function will store a copy of the named data set in the cache
directory. This cached copy of the data set will then be given precedence
at load time when calling load.project. Cached data sets are
stored as .RData or optionally as .qs files.
No value is returned; this function is called for its side effects.
Arguments
variable
A character string containing the name of the variable to
be saved. If the CODE parameter is defined, it is evaluated and saved, otherwise
the variable with that name in the global environment is used.
CODE
A sequence of R statements enclosed in {..} which produce the object to be
cached. Requires suggested package formatR.
depends
A character vector of other global environment objects that the CODE
depends upon. Caching will be forced if those objects have changed since last caching
tidyCODE
A logical scalar specifying if the CODE shall be tidied with
the help of tidy_source. As, for example, whitespace
changes do not change the meaning of the code and therefore should not
invalidate the cache, this usually is a desired feature. However, in case
the CODE contains, for example, complex SQL statements this might fail and
skipping this step is an even more desirable feature.
...
Additional arguments passed on to save or optionally
to qsave. See project.config for further
information.
Details
Usually you will want to cache datasets during munging. This can be the raw
data just loaded, or it can be the result of further processing during munge. Either
way, it can take a while to cache large variables, so cache will only cache when it
needs to.
The clear.cache("variable") command
can be run to flush individual items from the cache.
Calling cache() with no arguments returns the current status of the cache.