Give the complete path of the data and cache data on local disk
getDataPath.RdIt supports Nextcloud public links in case of using cloud. In this case,
this function can download the file in a temporary
folder and returns the path of the downloaded file.
This functionality is useful for read_excel from the package readxl
(See: https://stackoverflow.com/a/41368947/5300212).
Usage
getDataPath(
path,
...,
use_cache = TRUE,
cfg = loadConfig(),
root = cfg$data[[cfg$data$mode]],
cache = Sys.getenv("PKG_DATA_CACHE", file.path(dirname(tempdir()),
utils::packageName()))
)Arguments
- path
character representing the path of the data in the database
- ...
character path elements to add after
path- use_cache
logical download the data and use cache location
- cfg
a config object. Configuration to use. See loadConfig for details
- root
character URL or path of the database root
- cache
character path where downloaded files from cloud are cached (See details)
Value
character with the path of the file to read either on:
the local storage if
cfg$data$mode == "local"the cache directory if
cfg$data$mode != "local"anduse_cache == TRUEthe cloud URL if
cfg$data$mode != "local"anduse_cache == FALSE