Closure environments define the scope of functions (see
When a function call is evaluated, R creates an evaluation frame
ctxt_stack()) that inherits from the closure environment.
This makes all objects defined in the closure environment and all
its parents available to code executed within the function.
fn_env(fn) fn_env(x) <- value
A new closure environment for the function.
fn_env() returns the closure environment of
fn. There is also
an assignment method to set a new closure environment.
#>  TRUEother_env <- child_env("base") fn_env(fn) <- other_env identical(fn_env(fn), other_env)#>  TRUE