catrnav_set_cache_dir() stores your cache_dir path on your local
machine and makes it available for future sessions.
Alternatively, you can store the cache_dir manually with the following
options:
Run
Sys.setenv(CATASTRONAV_CACHE_DIR = "cache_dir"). You must run this command in each session (similar toinstall = FALSE).Write this line in your .Renviron file:
CATASTRONAV_CACHE_DIR = "value_for_cache_dir"(same behavior asinstall = TRUE). This stores yourcache_dirpermanently.
catrnav_detect_cache_dir() detects and returns the path to your current
cache_dir.
Usage
catrnav_set_cache_dir(
cache_dir,
overwrite = FALSE,
install = FALSE,
verbose = TRUE
)
catrnav_detect_cache_dir(...)Arguments
- cache_dir
A path to a cache directory. On missing value the function stores the cached files in a temporary dir (see
base::tempdir()).- overwrite
If this is set to
TRUE, it will overwrite an existingCATASTRONAV_CACHE_DIRthat you already have in local machine.- install
if
TRUE, will install the key in your local machine for use in future sessions. Defaults toFALSE. Ifcache_diris missing or empty this argument is set toFALSEautomatically.- verbose
Logical, displays information. Useful for debugging, default is
FALSE.- ...
Ignored
Value
catrnav_set_cache_dir() is called for its side effects, and returns an
(invisible) character with the path to your cache_dir.
catrnav_detect_cache_dir() returns the path to the cache_dir used in this
session
About caching
Sometimes cached files may be corrupt. In that case, try re-downloading
the data setting update_cache = TRUE.
If you experience any problem on download, try to download the
corresponding file by any other method and save it on your
cache_dir. Use the option verbose = TRUE for debugging the API query.
See also
Other cache utilities:
catrnav_clear_cache()
Examples
# Don't run this! It will modify your current state
# \dontrun{
catrnav_set_cache_dir(verbose = TRUE)
#> Using a temporary cache dir. Set 'cache_dir' to a value for store permanently
#> CatastRoNav cache dir is: /tmp/RtmpzXUTTC/CatastRoNav
# }
catrnav_detect_cache_dir()
#> [1] "/tmp/RtmpzXUTTC/CatastRoNav"
