| sys.parent {base} | R Documentation |
Functions to access the function call stack.
Description
These functions provide access to environments (“frames”
in S-speak) associated with functions further up the calling stack.
You need access to two different types of environments.
You need access to the environment where the arguments to a function
are defined; this is what sys.parent does.
You also need access to the environment where a function is being evaluated;
this is what sys.frame does.
Often sys.parent is the top-level environment, .GlobalEnv.
This is given number 1 in the list of frames. Each subsequent function
evaluation increases the frame stack by 1 and the environment for evaluation
of that function is returned by sys.frame with the appropriate index.
sys.call and sys.frame both accept either positive or negative
values for the argument which. Positive values of which count up
from frame 1 and negative values are count back from frame n.
Notice that even though the sys.xxx functions are interpreted their
contexts are not counted nor are they reported. There is no access to
them.
sys.status has not been implemented yet.
Usage
sys.call(which=<<see below>>)
sys.frame(which=<<see below>>)
sys.nframe()
sys.function(n=<<see below>>)
sys.parent(n=1)
sys.calls()
sys.frames()
sys.parents()
sys.on.exit()
Arguments
which |
the frame number. |
n |
the number of frame generations to go back. |
See Also
eval for the usage of sys.frame.