I have recently been programming in R and am struggling with getting line numbers for code, a common problem (as the question has been duplicated several times on SO). In other posts on stackoverflow options(error=dump.frames) and options(error=utils::recover) or options(error=recover) have been highly upvoted answers as solutions to this problem. However, there has been no answer that gives a specific description of the advantages and disadvantages of each error option. So my question when do you want to use options(error=utils::recover) and when do you want to use options(error=dump.frames)?
Asked
Active
Viewed 475 times
3
-
Regarding line numbers for code: Set `options(keep.source = TRUE)` to enable source file name and line number tracking in stack traces (`traceback` and `sys.calls`). You can then use the undocumented function `limitedLabels` to enrich the stack trace with the source references. For more details see https://journal.r-project.org/archive/2010-2/RJournal_2010-2_Murdoch.pdf – R Yoda Nov 03 '16 at 10:49