Get an object from an environment.
env_get() extracts an object from an enviroment
By default, it does not look in the parent environments.
env_get(env = caller_env(), nm, inherit = FALSE)
- An environment or an object with a S3 method for
env(). If missing, the environment of the current evaluation frame is returned.
- The name of a binding.
- Whether to look for bindings in the parent environments.
An object if it exists. Otherwise, throws an error.
parent <- new_env(empty_env(), list(foo = "foo")) env <- new_env(parent, list(bar = "bar")) # This throws an error because `foo` is not directly defined in env: # env_get(env, "foo") # However `foo` can be fetched in the parent environment: env_get(env, "foo", inherit = TRUE)
Looks like there are no examples yet.