29 R: traceback
29.1 Console
It is an error handler that is called immediately after encountering an error
You can set your
.Rprofile
or set options as:options(error = traceback)
To remove the options:
options(error = NULL)
Check
?traceback
for further detailsTo use
traceback
, run following function call that throws errorIn R console, type:
traceback()
The default display is of the stack of the last uncaught error
The stack of calls always contains all function calls and all foreign function calls in the call sequence with line number
29.1.1 traceback
: Call 1
This call does not display an error; so traceback
is not available
29.1.2 traceback
: Call 2
This function call displays an error; so traceback
is available
29.2 RStudio Environment
Select:
Debug > On Error > Error Inspector
Run the following function and explore
traceback
29.2.1 traceback
: Call 3
This function call displays an error; so traceback
is available
Code
X = c(NA, 12, 0, "A", 18)
fn_Mean(X, na.rm = TRUE)