sys.call(which=<<see below>>) sys.frame(which=<<see below>>) sys.nframe() sys.function(n=<<see below>>) sys.parent(n=1) parent.frame(n=1) sys.calls() sys.frames() sys.parents() sys.on.exit() sys.status(n = sys.parent())
sys.call returns the actual call for frame
which.
By default,
which is the frame in which the call to
sys.call is made.
sys.frame returns the list of objects in frame
which.
By default,
which is the frame in which the call to
sys.call is made.
sys.nframe returns the numerical index of the current frame
in the list of all frames.
sys.function returns the definition of the function being called in
frame
n (the current frame by default).
sys.parent returns the index in the list of frames of the parent
(i.e., the caller) of the current function.
The argument to
sys.parent says how many generations to go back (by
default, to the caller of the caller of
sys.parent).
parent.frame is a synonym for
sys.parent.
sys.calls returns the list of the function calls that generated the frames.
sys.frames is the list of the frames themselves (i.e., each component is a
list giving the named objects in that frame, including the matched arguments
in the call).
sys.parents gives the indices of the parent frames of each of the frames.
sys.on.exit is the list of expressions given to
on.exit and currently
still scheduled to be evaluated on exit from the corresponding frame.
sys.status returns the complete internal evaluator status; that is, everything above.
These functions all return various objects describing the current state of
the S-PLUS evaluator, in terms analogous to the model described in chapter 11
of Becker, Chambers and Wilks.
The first four functions describe the current frame (the function
call from which, e.g.,
sys.call was called).
Most of the remaining functions describe the list of all frames that
are currently open in the evaluator.
Use
frame to advance the graphics frame.
sys.call returns an object of class call
and so does
match.call. The difference is
that
sys.call returns the actual call
(with argument names missing or abbreviated),
and
match.call returns the call for which
the arguments are specified by name.
Use
match.call when creating a
call
component or attribute.
Becker, R.A., Chambers, J.M., and Wilks, A.R. (1988) The New S Language. Wadsworth and Brooks/Cole. Pacific Grove, CA.
# remove an object from my own local frame
remove("xxx",frame = sys.nframe())
myplot <- function(x, y)
{
the.call <- sys.call()
xname <- deparse(the.call[[2]])
yname <- deparse(the.call[[3]])
plot(x, y, xlab = xname, ylab = yname)
return(list(call = the.call))
}