Printing stack trace and continuing after error occurs in R

前端 未结 8 2077
再見小時候
再見小時候 2020-12-08 04:42

I\'m writing some R code that calls other code that may fail. If it does, I want to print a stack trace (to track down what went wrong), then carry on regardless. However, t

8条回答
  •  感动是毒
    2020-12-08 05:33

    If something that triggers on option(error...) is of interest, you can also do this:

    options(error=traceback)
    

    From what I can tell, it does most of what Bob's suggested solution do, but has the advantage of being much shorter.

    (Feel free to combine with keep.source=TRUE, warn=2, etc. as needed.)

提交回复
热议问题