A set of functions to run code ‘with’ safely and temporarily modified global state. There are two sets of functions, those prefixed with
with_ and those with
local_. The former reset their state as soon as the
code argument has been evaluated. The latter reset when they reach the end of their scope, usually at the end of a function body.
Many of these functions were originally a part of the devtools package, this provides a simple package with limited dependencies to provide access to these functions.
local_collate()- collation order
local_dir()- working directory
local_envvar()- environment variables
local_libpaths()- library paths
local_locale()- any locale setting
local_makevars()- Makevars variables
local_par()- graphics parameters
local_path()- PATH environment variable
local_()functions for the built in R devices,
local_connection()- R connections.
with_environment()- to run code with modified object search paths.
local_tempfile()- Create and clean up a temp file.
local_file()- Create and clean up a normal file.
These functions are variants of the corresponding
with_() function, but rather than resetting the value at the end of the function call they reset when the current context goes out of scope. This is most useful for using within functions.