Temporarily change the current working directory.
Arguments
- new
[character(1)]
New working directory
- code
[any]
Code to execute in the temporary environment
- .local_envir
[environment]
The environment to use for scoping.
Value
[any]
The results of the evaluation of the code
argument.
Examples
getwd()
#> [1] "/cluster-data/user-homes/elizabethb/projects/pkgdown-docs/prism/package-info/withr_3.0.2/docs/reference"
with_dir(tempdir(), getwd())
#> [1] "/tmp/RtmpQBl5F0"