env_bury

0th

Percentile

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.

Usage
env_bury(env = caller_env(), data = list())
Arguments
env
An environment or an object with a S3 method for env(). If missing, the environment of the current evaluation frame is returned.
data
A vector with unique names which defines bindings (pairs of name and value). See is_dictionary().
Value

An object associated with the new environment.

Aliases
  • env_bury
Examples
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()
Documentation reproduced from package rlang, version 0.0.0.9000, License: GPL-3

Community examples

Looks like there are no examples yet.