Set, unset or query the debugging flag on a function. The text and condition arguments are the same as those that can be supplied via a call to browser. They can be retrieved by the user once the browser has been entered, and provide a mechanism to allow users to identify which breakpoint has been activated.
debug(fun, text = "", condition = NULL, signature = NULL)
debugonce(fun, text = "", condition = NULL, signature = NULL)
undebug(fun, signature = NULL)
isdebugged(fun, signature = NULL)
debuggingState(on = NULL)
| Parameter | Description |
|---|---|
fun |
any interpreted R function. |
text |
a text string that can be retrieved when the browser is entered. |
condition |
a condition that can be retrieved when the browser is entered. |
signature |
an optional method signature. If specified, the method is debugged, rather than its generic. |
on |
logical; a call to the support function debuggingState returns TRUE if debugging is globally turned on, FALSE otherwise. An argument of one or the other of those values sets the state. If the debugging state is FALSE, none of the debugging actions will occur (but explicit browser calls in functions will continue to work). |
# NOT RUN {
debug(library)
library(methods)
# }
# NOT RUN {
debugonce(sample)
## only the first call will be debugged
sampe(10, 1)
sample(10, 1)
# }