Sets (if create = TRUE) or gets the cache
directory associated with the Require package.
Usage
cacheDir(create, verbose = getOption("Require.verbose"))
cachePkgDir(create)Arguments
- create
A logical indicating whether the path should be created if it does not exist. Default is
FALSE.- verbose
Numeric or logical indicating how verbose should the function be. If -1 or -2, then as little verbosity as possible. If 0 or FALSE, then minimal outputs; if
1or TRUE, more outputs;2even more. NOTE: inRequirefunction, whenverbose >= 2, also returns details as ifreturnDetails = TRUE(for backwards compatibility).
Value
If !is.null(cacheGetOptionCachePkgDir()), 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.
Details
To set a different directory than the default, set the system variable:
R_REQUIRE_CACHE = "somePath" and/or R_REQUIRE_PKG_CACHE = "somePath"
e.g., in .Renviron file or Sys.setenv(). See Note below.
Note
There are two different cache directories used by Require: cacheDir and cachePkgDir.
The cachePkgDir is intended to be a sub-directory of the cacheDir.
If you set Sys.setenv("R_REQUIRE_CACHE" = "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_REQUIRE_CACHE" and
"R_REQUIRE_PKG_CACHE" environment variables.
The package cache can also be set with options("Require.cachePkgDir" = "somedir").