if (FALSE) { # identical(Sys.getenv("NOT_CRAN"), "true")
# A file-backed object cached on one machine records where its files lived.
# remapFilenames() translates those to where they belong on THIS machine,
# using the anchors (e.g. inputPath) supplied in `paths`.
inputDir <- file.path(tempdir(), "remapExample")
dir.create(inputDir, showWarnings = FALSE)
tags <- c(
"origFilename:dem.tif",
"origRelName:dem.tif",
"relToWhere:inputPath", # the anchor the file was stored relative to
"filesToLoad:/some/other/machine/inputs/dem.tif"
)
newFiles <- remapFilenames(
tags = tags, cachePath = NULL,
paths = list(inputPath = inputDir)
)
newFiles$newName # now under THIS machine's inputPath
unlink(inputDir, recursive = TRUE)
}
Run the code above in your browser using DataLab