Returns the path to the cache directory used by pr_get_tree() and
pr_date_tree() when called with cache = TRUE. Pass a path to
override the default.
Details
The default cache directory is tools::R_user_dir() with type
"cache" and the package name "prepR4pcm", which on Linux is
typically ~/.cache/R/prepR4pcm/, on macOS
~/Library/Caches/org.R-project.R/R/prepR4pcm/, and on Windows
something under %LOCALAPPDATA%\R\cache\R\prepR4pcm\.
To use a cache directory you control, pass its path explicitly with
pr_tree_cache_dir(path).
See also
pr_tree_cache_status() / pr_tree_cache_clear();
pr_get_tree() for the consumer.
Examples
# Default location
pr_tree_cache_dir()
#> [1] "/Users/z3437171/Library/Caches/org.R-project.R/R/prepR4pcm"
old_cache <- getOption("prepR4pcm.cache_dir", NULL)
tmp_cache <- tempfile("prepR4pcm-cache-")
pr_tree_cache_dir(tmp_cache)
options(prepR4pcm.cache_dir = old_cache)
unlink(tmp_cache, recursive = TRUE)