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)
Run the code above in your browser using DataLab