enw_set_cache | R Documentation |
This function allows the user to set a cache location for Stan models rather than a temporary directory. This can reduce the need for model compilation on every new model run across sessions or within a session. For R version 4.0.0 and above, it's recommended to use the persistent cache as shown in the example.
enw_set_cache(path, type = c("session", "persistent", "all"))
path |
A valid filepath representing the desired cache location. If the directory does not exist it will be created. |
type |
A character string specifying the cache type. It can be one of
"session", "persistent", or "all". Default is "session".
"session" sets the cache for the current session, "persistent" writes the
cache location to the user's |
The string of the filepath set.
Functions used to help convert models into the format required for stan
enw_formula_as_data_list()
,
enw_get_cache()
,
enw_model()
,
enw_pathfinder()
,
enw_priors_as_data_list()
,
enw_replace_priors()
,
enw_sample()
,
enw_stan_to_r()
,
enw_unset_cache()
,
remove_profiling()
,
write_stan_files_no_profile()
# Set to local directory
my_enw_cache <- enw_set_cache(file.path(tempdir(), "test"))
enw_get_cache()
## Not run:
# Use the package cache in R >= 4.0
if (R.version.string >= "4.0.0") {
enw_set_cache(
tools::R_user_dir(package = "epinowcast", "cache"), type = "all"
)
}
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.