RequireCacheDir: Path to (package) cache directory

View source: R/setup.R

RequireCacheDirR Documentation

Path to (package) cache directory

Description

Sets (if create = TRUE) or gets the cache directory associated with the Require package.

Usage

RequireCacheDir(create)

RequirePkgCacheDir(create)

Arguments

create

A logical indicating whether the path should be created if it does not exist. Default is FALSE.

Details

To set a different directory than the default, set the system variable: R_USER_CACHE_DIR = "somePath" and/or R_REQUIRE_PKG_CACHE = "somePath" e.g., in .Renviron file or Sys.setenv(). See Note below.

Value

If !is.null(getOptionRPackageCache()), i.e., a cache path exists, the cache directory will be created, with a README placed in the folder. Otherwise, this function will just return the path of what the cache directory would be.

Note

Currently, there are 2 different Cache directories used by Require: RequireCacheDir and RequirePkgCacheDir. The RequirePkgCacheDir is intended to be a sub-directory of the RequireCacheDir. If you set Sys.setenv("R_USER_CACHE_DIR" = "somedir"), then both the package cache and cache dirs will be set, with the package cache a sub-directory. You can, however, set them independently, if you set "R_USER_CACHE_DIR" and "R_REQUIRE_PKG_CACHE" environment variable. The package cache can also be set with options("Require.RPackageCache" = "somedir").


Require documentation built on May 31, 2023, 7:06 p.m.