Debugging
Theory
messagejust a generic notification as messagewarningsomething could go wrongerrorfatal error that stops executionconditiongeneric concept indicating something unexpected happened
Functions
tracebackprints out the function call stack tracedebugflags function for debug modebrowsersuspends execution and starts function in debugtraceallows insert debugging code into a functionrecoverallows to modify error behavior so function stact trace can be browsed
Examples
traceback
> mean(x)
Error in mean(x) : object 'x' not found
> traceback()
1: mean(x)debug
> debug(lm)
> lm (y- x)
debugging in: lm(y - x)And you continue to debugging window.
recover
> options(error=recover)
> read.csv("donotexitfile")
Error in file(file, "rt") : cannot open the connection
In addition: Warning message:
In file(file, "rt") :
cannot open file 'donotexitfile': No such file or directory
Enter a frame number, or 0 to exit
1: read.csv("donotexitfile")
2: read.table(file = file, header = header, sep = sep, quote = quote, dec = dec, fill = fill, comment.char = comment.char, ...)
3: file(file, "rt")Last updated
Was this helpful?