Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

R equivalent to MATLAB's "stop if error"

Tags:

r

debugging

I'm attempting to debug an R program, and I'm sorely missing the stop if error capability of matlab. I've gone through the R-debug-tools.pdf (mirror) documentation, but it didn't list anything like this. Is there any way to instruct R that, when any error at all is encountered - even one I didn't anticipate and plan for with a custom trace function - it should stop execution and throw me into browser() mode?

like image 785
eykanal Avatar asked Jan 20 '12 15:01

eykanal


1 Answers

I believe you want options(error=recover)

like image 137
Ben Bolker Avatar answered Oct 12 '22 18:10

Ben Bolker