Temporarily set options then restore them while running code

.rxWithWd(wd, code)

Arguments

wd

working directory to temporarily set the system to while evaluating the code

code

The code to run during the sink

Value

value of code

Examples


.rxWithWd(tempdir(), {
  getwd()
})
#> [1] "/tmp/RtmpogyZre"

getwd()
#> [1] "/tmp/RtmpogyZre/file4084d0f110d/reference"