Learn R Programming

CatastRo (version 0.4.1)

catr_set_cache_dir: Set your CatastRo cache dir

Description

catr_set_cache_dir() will store your cache_dir path on your local machine and would load it for future sessions.

Alternatively, you can store the cache_dir manually with the following options:

  • Run Sys.setenv(CATASTROESP_CACHE_DIR = "cache_dir"). You would need to run this command on each session (Similar to install = FALSE).

  • Write this line on your .Renviron file: CATASTROESP_CACHE_DIR = "value_for_cache_dir" (same behavior than install = TRUE). This would store your cache_dir permanently.

catr_detect_cache_dir() detects and returns the path to your current cache_dir.

Usage

catr_set_cache_dir(
  cache_dir = NULL,
  overwrite = FALSE,
  install = FALSE,
  verbose = TRUE
)

catr_detect_cache_dir(...)

Value

catr_set_cache_dir() is called for its side effects, and returns an (invisible) character with the path to your cache_dir.

catr_detect_cache_dir() returns the path to the cache_dir used in this session

Arguments

cache_dir

A path to a cache directory. On NULL value (the default) the function would store the cached files on the tempdir.

overwrite

If this is set to TRUE, it will overwrite an existing CATASTROESP_CACHE_DIR that you already have in local machine.

install

if TRUE, will install the key in your local machine for use in future sessions. Defaults to FALSE. If cache_dir is FALSE this parameter is set to FALSE automatically.

verbose

Logical, displays information. Useful for debugging, default is FALSE.

...

Ignored

About caching

Sometimes cached files may be corrupt. On 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

rappdirs::user_config_dir()

Other cache utilities: catr_clear_cache()

Examples

Run this code

# Don't run this! It would modify your current state
if (FALSE) {
catr_set_cache_dir(verbose = TRUE)
}


catr_detect_cache_dir()

Run the code above in your browser using DataLab