traceback package:base R Documentation _P_r_i_n_t _C_a_l_l _S_t_a_c_k_s _D_e_s_c_r_i_p_t_i_o_n: By default 'traceback()' prints the call stack of the last uncaught error, i.e., the sequence of calls that lead to the error. This is useful when an error occurs with an unidentifiable error message. It can also be used to print arbitrary lists of deparsed calls. _U_s_a_g_e: traceback(x = NULL, max.lines = getOption("deparse.max.lines")) _A_r_g_u_m_e_n_t_s: x: 'NULL' (default, meaning '.Traceback'), or a list or pairlist of deparsed calls. max.lines: The maximum number of lines to be printed _per call_. The default is unlimited. _D_e_t_a_i_l_s: The stack of the last uncaught error is stored as a list of deparsed calls in '.Traceback', which 'traceback' prints in a user-friendly format. The stack of deparsed calls always contains all function calls and all foreign function calls (such as '.Call'): if profiling is in progress it will include calls to some primitive functions. (Calls to builtins are included, but not to specials.) Errors which are caught _via_ 'try' or 'tryCatch' do not generate a traceback, so what is printed is the call sequence for the last uncaught error, and not necessarily for the last error. _V_a_l_u_e: 'traceback()' returns nothing, but prints the deparsed call stack deepest call first. The calls may print on more than one line, and the first line for each call is labelled by the frame number. The number of lines printed per call can be limited via 'max.lines'. _W_a_r_n_i_n_g: It is undocumented where '.Traceback' is stored nor that it is visible, and this is subject to change. Prior to R 2.4.0 it was stored in the workspace, but no longer. _R_e_f_e_r_e_n_c_e_s: Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988) _The New S Language_. Wadsworth & Brooks/Cole. _E_x_a_m_p_l_e_s: foo <- function(x) { print(1); bar(2) } bar <- function(x) { x + a.variable.which.does.not.exist } ## Not run: foo(2) # gives a strange error traceback() ## End(Not run) ## 2: bar(2) ## 1: foo(2) bar ## Ah, this is the culprit ...