cache | R Documentation |
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.
cache(variable = NULL, CODE = NULL, depends = NULL, ...)
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 |
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 |
... |
Additional arguments passed on to |
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.
No value is returned; this function is called for its side effects.
qsave
, project.config
library('ProjectTemplate')
## Not run: create.project('tmp-project')
setwd('tmp-project')
dataset1 <- 1:5
cache('dataset1')
setwd('..')
unlink('tmp-project')
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.