Description Usage Arguments Details Value
Capture the environment of a function.
1 2 | capture_env(local = FALSE, global_name = "captured_result",
save_env = .GlobalEnv)
|
local |
A logical value, default |
global_name |
The name to be used when the function is terminated and the environment should be investigated in the global workspace. |
save_env |
The environment where the result should be
assigned. Default value |
This function can, when inserted into the body of another
function, capture the environment at the inserted place. The
rationale for this is to make it easier to hunt for errors or
develop new code. attach
and detach
can be used
on the captured environment in order to get hold of (or get rid
of) the internal objects of the targeted function. This
function can be used directly, but it might be more efficient
to use the function under_construction
(with the helpers
uc_help
and uc_help_call
) instead, those
functions will take care of a lot of the pesky details required
to attaching and detaching the captured environments.
This function clones the environment of the targeted
function at the place of insertion. If local=TRUE
, then
the cloned environment will be returned to the internal
work-flow of the function, the default is to create an object
in the global workspace, named by global_name
. Warning,
be aware of the potential memory-problems that might occur if
you attempt to store the temporary environment from several
different steps in the function.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.