sys.call
Get the System Evaluator State

Description

Returns information from the evaluator stack.

Usage

sys.call(which = 0)
sys.frame(which = 0)
sys.nframe()
sys.function(which = 0)
sys.parent(n = 1)
parent.frame(n = 1)
sys.calls() 
sys.frames() 
sys.parents()
sys.on.exit()
sys.status()

Arguments

which the stack frame number if strictly positive; the current frame if zero. Otherwise, the number of stack frames to go back.
n the number of stack frames to go back.

Details

All of these functions return various objects describing the current state of the evaluator in terms analogous to the model described in chapter 11 of Becker, Chambers and Wilks. The first six functions describe a particular stack frame: by the default, the current frame (for example, the function call from which sys.call was called). Most of the remaining functions describe the list of all stack frames.
Value

sys.callreturns the actual call for the frame specified by which. By default, which is the stack frame in which the call to sys.call is made.
sys.framereturns the local environment in the stack frame specified by which. By default, sys.frame returns the global environment.
sys.nframereturns the numerical index of the current stack frame in the stack.
sys.functionreturns the definition of the function being called in the stack frame n (by default, the current stack frame).
sys.parentreturns the index in the list of stack frames of the parent (that is, the caller) of the current function. The argument to sys.parent specifies how many steps to go back in the call chain. (By default, it goes to the caller of the caller of sys.parent).
parent.framereturns the environment of the parent (that is, the caller) of the current function. The argument to parent.frame specifies how many steps to go back in the call chain. (By default, it goes back to the caller of the caller of parent.frame).
All stack frames:
sys.callsreturns the list of the function calls that generated the frames.
sys.framesreturns a list with the local environments for the stack frames.
sys.parentsreturns the indices of the parent frames for each of the frames.
sys.on.exitreturns the list of expressions given to on.exit and currently still scheduled to be evaluated on exit from the corresponding frame.
sys.statusreturns the complete internal evaluator status; that is, everything above.
References
Becker, R.A., Chambers, J.M., and Wilks, A.R. (1988) The New S Language. Wadsworth and Brooks/Cole. Pacific Grove, CA.
Note
See Also
frame.attr, match.call
Examples

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)) }

Package base version 6.1.4-13
Package Index