call stack of a function

Share:

Description

trace the call stack e.g. for error checking and format output for do.call levels

Usage

1
traceCall(skip = 0)

Arguments

skip

Number of levels to skip in traceback

Value

Character string with the call stack

Warning

In do.call settings with large objects, tracing may take a lot of computing time.

Author(s)

Berry Boessenkool, berry-b@gmx.de, Sep 2016

See Also

checkFile for example usage

Examples

1
2
3
4
5
6
7
lower <- function(a, s) warning(traceCall(s), "final value is: ", a+10)
upper <- function(b, skip=0) lower(b+5, skip)
upper(3)
upper(3, skip=1) # traceCall skips last level (warning)
upper(3, skip=4) # now the stack is empty
upper(3, skip=-1) # get one more level down
is.error(upper("four"))

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.