traceback(x = NULL, max.lines = getOption("deparse.max.lines"),
print.context = TRUE)
| x | any list of calls. If NULL (the default), then the saved call stack from the most recent error is used. A numeric x is treated the same as NULL. |
| max.lines | the maximum number of lines to be printed for each call. If this is NULL or any other non-numeric value, a maximum of 10 lines are printed. |
| print.context | a logical flag. If TRUE (the default) and the engine has saved additional context information with the call stack, it is printed to the screen instead of the x value or the normal saved call stack. Context information is available only when starting the engine with the -debug flag. Set this argument to FALSE to ignore any context information. |
f1 <- function(x) { y <- x+4; f2(y)}
f2 <- function(x) undefined.variable + x
f1(5)
traceback()
x <- c(2.36, 0.89, -0.25, -0.86, 0.58)
y <- c(0.67, 0.094, 0.49, 0.46, 0.37)
traceback(x) # print x list of deparsed calls
glm(y~x, family = quasi(link = power(2))) # generate an error
traceback() # print the call stack with error information
traceback(max.lines = 3)
# print the call stack with error information,
# the lines for each call is no more than 3.