1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
|
library("R.cache")
setupCacheRootPath <- R.cache:::setupCacheRootPath
oopts <- options()
tmpdir <- tempdir()
setCacheRootPath(path=tmpdir)
print(getCacheRootPath())
setupCacheRootPath(defaultPath=tmpdir)
path <- getCacheRootPath(NULL)
print(path)
stopifnot(identical(path, tmpdir))
options("R.cache.rootPath"=NULL)
print(getCacheRootPath())
path <- getCacheRootPath(NULL)
print(path)
stopifnot(is.null(path))
setupCacheRootPath(defaultPath=tmpdir)
path <- getCacheRootPath(NULL)
print(path)
stopifnot(identical(path, tmpdir))
## Reset
options(oopts)
|