call stack of a function

Description

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

Usage

1
traceCall(skip = 0, prefix = "\nCall stack: ", suffix = "\n")

Arguments

skip

Number of levels to skip in traceback

prefix

Prefix prepended to the output character string. DEFAULT: "\nCall stack: "

suffix

Suffix appended to the end of the output. DEFAULT: "\n"

Value

Character string with the call stack

Warning

Called from 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

tryStack, checkFile for example usage

Examples

1
2
3
4
5
6
7
8
9
lower <- function(a, s) {warning(traceCall(s), "stupid berry warning: ", a+10); a}
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
d <- tryStack(upper("four"), silent=TRUE)
inherits(d, "try-error")
cat(d) 

Questions? Problems? Suggestions? or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.