Bury bindings and define objects in new scope.
env_bury() is like
env_bind() but it creates the
bindings in a new child environment. Note that this function does
not modify its inputs.
env_bury(env = caller_env(), data = list())
- An environment or an object with a S3 method for
env(). If missing, the environment of the current evaluation frame is returned.
- A vector with unique names which defines bindings
(pairs of name and value). See
An object associated with the new environment.
scope <- new_env(base_env(), list(a = 10)) fn <- function() a env(fn) <- scope # fn() sees a = 10: fn() # env_bury() will bury the current scope of fn() behind a new # environment: fn <- env_bury(fn, list(a = 1000)) fn()
Looks like there are no examples yet.