Aliases: env_parent env_tail env_parents
Keywords:
### ** Examples # Get the parent environment with env_parent(): env_parent(global_env())
<environment: package:rlang> attr(,"name") [1] "package:rlang" attr(,"path") [1] "/data/rcloud/library/4.2/rlang"
# Or the tail environment with env_tail(): env_tail(global_env())
<environment: base>
# By default, env_parent() returns the parent environment of the # current evaluation frame. If called at top-level (the global # frame), the following two expressions are equivalent: env_parent()
<environment: R_GlobalEnv>
env_parent(base_env())
<environment: R_EmptyEnv>
# This default is more handy when called within a function. In this # case, the enclosure environment of the function is returned # (since it is the parent of the evaluation frame): enclos_env <- env() fn <- set_env(function() env_parent(), enclos_env) identical(enclos_env, fn())
[1] TRUE