Does an environment have or see bindings?
env_has() is a vectorised predicate that queries whether an
environment owns bindings personally (with
inherit set to
FALSE, the default), or sees them in its own environment or
in any of its parents (with
inherit = TRUE).
env_has(env = caller_env(), nms, inherit = FALSE)
- An environment or an object with a S3 method for
env(). If missing, the environment of the current evaluation frame is returned.
- A character vector containing the names of the bindings to remove.
- Whether to look for bindings in the parent environments.
A logical vector as long as
parent <- new_env(empty_env(), list(foo = "foo")) env <- new_env(parent, list(bar = "bar")) # env does not own `foo` but sees it in its parent environment: env_has(env, "foo") env_has(env, "foo", inherit = TRUE)
Looks like there are no examples yet.