Skip to contents

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.

Usage

pr_tree_cache_dir(path = NULL)

Arguments

path

A length-1 character vector or NULL. If non-NULL, sets the cache directory to path (creating it if it doesn't exist). If NULL (default), returns the currently configured directory.

Value

A length-1 character vector — the absolute path of the cache directory.

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 project-local cache (so it's checked in with your analysis), set the path to a subdirectory of your project — e.g. pr_tree_cache_dir("./.tree-cache").

Examples

# Default location
pr_tree_cache_dir()
#> [1] "/Users/z3437171/Library/Caches/org.R-project.R/R/prepR4pcm"

if (FALSE) { # \dontrun{
  # Project-local cache
  pr_tree_cache_dir("./.tree-cache")
} # }