Get or set the location of the Gesel cache directory, used as the default in functions like downloadGeneFile and downloadDatabaseFile.

cacheDirectory(cache = NULL)

Arguments

cache

String specifying the path to a cache directory.

Value

If cache=NULL, the path to the current cache directory is returned.

If cache is provided, it is set as the path to the cache directory, and the previous location is invisibly returned.

Details

The cache directory defaults to a location in the user cache directory, as chosen by the rappdirs package. Users can modify this choice by setting the GESEL_CACHE_DIRECTORY environment variable before the first call to this function.

Author

Aaron Lun

Examples

cacheDirectory()
#> [1] "~/.cache/gesel"

old <- cacheDirectory("/tmp/foo/bar")
cacheDirectory()
#> [1] "/tmp/foo/bar"

cacheDirectory(old)
cacheDirectory()
#> [1] "~/.cache/gesel"