traceCall: call stack of a function

Description Usage Arguments Value Author(s) See Also Examples

View source: R/traceCall.R

Description

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

Usage

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

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"

vigremove

Logical: remove call created using devtools::build_vignettes()? DEFAULT: TRUE

Value

Character string with the call stack

Author(s)

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

See Also

tryStack, checkFile for example usage

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
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
d <- tryStack(upper("four"), silent=TRUE)
inherits(d, "try-error")
cat(d) 

lower <- function(a,...) {warning(traceCall(1,"",": "), "stupid berry warning: ", 
                                  a+10, call.=FALSE); a}
upper(3)

berryFunctions documentation built on May 20, 2017, 4:12 a.m.

Search within the berryFunctions package
Search all R packages, documentation and source code