Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

It the little bits of R programming I've done, the biggest pain for me was debugging. If something fails, I had no idea what line of code the error happened. Since some of the functions were rather long, step-wise debugging was laborious.


Yeah, I had this problem until I discovered options(error=recover) which drops you into a nice lispy stack. And ya, someone told me about it: I don't know where you'd read about such things. There's probably a dozen alternatives I also don't know where to read about.


Theres a pretty nice chapter on debugging in the great book Advanced R [1]. Hadley for the rescue! (As is commonplace in the context of R)

[1]: https://adv-r.hadley.nz/debugging.html


Besides the aforementioned browser(), try() and tryCatch(), you would check the packages assertive and assertr to guarantee the expected inputs, and testthat to create tests for your scripts. All awesome.


It's got tryCatch, and the browser function works wonders.




Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: