env_unbind
From rlang v0.2.2
by Lionel Henry
Remove bindings from an environment
env_unbind()
is the complement of env_bind()
. Like env_has()
,
it ignores the parent environments of env
by default. Set
inherit
to TRUE
to track down bindings in parent environments.
Usage
env_unbind(env = caller_env(), nms, inherit = FALSE)
Arguments
Value
The input object env
with its associated environment
modified in place, invisibly.
Examples
# NOT RUN {
data <- set_names(as_list(letters), letters)
env_bind(environment(), !!! data)
env_has(environment(), letters)
# env_unbind() removes bindings:
env_unbind(environment(), letters)
env_has(environment(), letters)
# With inherit = TRUE, it removes bindings in parent environments
# as well:
parent <- child_env(NULL, foo = "a")
env <- child_env(parent, foo = "b")
env_unbind(env, "foo", inherit = TRUE)
env_has(env, "foo", inherit = TRUE)
# }
Community examples
Looks like there are no examples yet.