debug.error {provDebugR} | R Documentation |
Tracking the Lineage of Errors and Warnings
Description
debug.error displays the backwards lineage of (the statements leading up to) an error that occurred when R code was executed.
debug.warning displays the backwards lineage of (the statements leading up to) one or more warnings that occurred when R code was executed.
Usage
debug.error(stack.overflow = FALSE)
debug.warning(..., all = FALSE)
Arguments
stack.overflow |
If TRUE, the error message will be searched for on Stack Overflow. |
... |
The warning(s) to be queried. |
all |
If TRUE, the lineages of all warnings are returned. |
Details
These functions are part of the provDebugR package. To use them, you must
first initialise the debugger using
one its initialisation functions: prov.debug
,
prov.debug.file
, or prov.debug.run
.
The lineage is represented with a data frame that shows the R statements whose execution led to the error or warning. More specifically, each row of the data frame corresponds to one line of code. The columns of the data frame are:
scriptNum: The script number the statement is from.
scriptName: The name of the script the statement is from.
startLine: The line number for the statement If the statement spans multiple lines, this will be the first line.
code: The statement itself. If the statement is long, this will just be the start of the statement.
Value
debug.error returns a data frame representing the backwards lineage of the error in the execution, if any.
debug.warning returns a list of data frames of lineages for the queried warnings.
See Also
provDebugR Initialisation Functions:
Other provDebugR Functions (non-initialisation):
debug.line
: Returns all immediate inputs and outputs
for the line(s) queried.
debug.lineage
: Returns the forwards or backwards lineage
of the data object(s) queried. The forwards lineage shows how the
data object was used, and the backwards lineage shows how it was produced.
debug.state
: Returns the state at the line(s) queried,
after the line had been executed. The state is the list of all
variables and their values in the environment at the queried line.
debug.type.changes
: Returns a data frame for each variable in
the execution containing the instances where the data type changed.
debug.variable
: Returns a data frame showing all instances
of the variable(s) queried.
debug.view
: Opens and displays the contents of each file or variable
or variable queried.
Examples
## Not run:
prov.debug.run("test.R")
debug.error()
debug.error(stack.overflow = TRUE)
debug.warning(1)
debug.warning(2,3)
debug.warning(all = TRUE)
## End(Not run)