Temporarily evaluate an expression in a directory, then set the directory back to the original.
with_wd(dir, expr)
a directory to perform an expression within.
expression to evaluate.
See here: http://plantarum.ca/code/setwd-part2/
## Create a directory called 'hola' and then check that it exists
with_wd(tempdir(), {
dir.create("hola", showWarnings = FALSE)
file.exists("hola")
})
#> [1] TRUE