This function is a "constructor" for with_... functions. It
is only needed if you want to alter some global state which is
not covered by the existing with_... functions, see
withr-package for an overview.
Usage
with_(set, reset = set, envir = parent.frame())
Arguments
set
[function(...)] Function used to set the state.
The function can have arbirarily many arguments, they will be replicated
in the formals of the returned function.
reset
[function(x)] Function used to reset the state.
The first argument can be named arbitrarily, further arguments with default
values, or a "dots" argument, are supported but not used: The function will
be called as reset(old).
envir
[environment] Environment of the returned function.
Value
[function(new, code, ...)] A function with at least two arguments,
new: New state to use
code: Code to run in that state.
If there are more arguments to the function passed in set they are
added to the returned function. If set does not have arguments,
the returned function only has a code argument.