General suggestions for debugging in R

后端 未结 13 2371
梦毁少年i
梦毁少年i 2020-11-22 12:26

I get an error when using an R function that I wrote:

Warning messages:
1: glm.fit: algorithm did not converge 
2: glm.fit: algorithm did not converge 
         


        
13条回答
  •  暖寄归人
    2020-11-22 12:57

    Mark Bravington's debugger which is available as the package debug on CRAN is very good and pretty straight forward.

    library(debug);
    mtrace(myfunction);
    myfunction(a,b);
    #... debugging, can query objects, step, skip, run, breakpoints etc..
    qqq(); # quit the debugger only
    mtrace.off(); # turn off debugging
    

    The code pops up in a highlighted Tk window so you can see what's going on and, of course you can call another mtrace() while in a different function.

    HTH

提交回复
热议问题