General suggestions for debugging in R -
I get an error when I use an R function that I have written:
Warning message: 1: glm.fit: Algorithm 2: glm.fit: Algorithm is not found
What I did:
- Step through function
- Adding a print to find out the line that is causing an error suggests two functions that should not use
glm.fit
.Window ()
andsave ()
.
In my normal view, by the command and function line, when I can find the exception, print
and stop
Till i step up
However, it is not clear to me that the use of those techniques comes from where this error code comes from. I'm also not sure whether the code working inside the code depends on glm.fit
. How can I go about diagnosing this problem?
I will say that debugging is an art, so there is no clear silver bullet in any language debugging There are good strategies for them, and they apply here (e.g., for example, the first thing is that reproduction of the problem ... if you can not do this, you get more information Need to do (like with logging) once you can reproduce it, you can Instead of "move," I would say that my favorite debugging routine is: The best new move in R 2.10 (when working with script files) is As a last commentary: Depending on the error, it is very useful to set There are many suggestions in these related questions:
option (error = ok)
; It switches quickly in browser mode, where An error occurs, so you can browse workspace from there. debug ()
line from the script line Through function and phase findLineNum ()
and setBreakpoint ()
Uses works. try ()
or tryCatch ()
( Especially working with S4 classes)