[R] Line numbers with errors and warnings?

jim holtman jholtman at gmail.com
Fri Nov 30 22:42:11 CET 2012


One thing that I do when I have a long script is to put "progress"
report messages.  These have some comments so I can chart the progress
and also print out the current CPU and memory usage so I can also
isolate where potential problems might be.  This will help narrow down
the section of code where the error occurred.  Are you also running
with

options(error=utils::recover)

so that when the error occurs, you get the stack and current
environment so that debugging is easier?

On Fri, Nov 30, 2012 at 4:22 PM, Worik R <worikr at gmail.com> wrote:
> Is it possible to get a line number with an error report?
>
> I have a long script and an error:
>
> Error in `[.xts`(x, xsubset) : subscript out of bounds
>
>
> It would be very helpful, and save a lot of time, if there was some
> indication in the error message which line the error was.
>
> I can find it using binary search but that is a painful process.
>
> cheers
> Worik
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



-- 
Jim Holtman
Data Munger Guru

What is the problem that you are trying to solve?
Tell me what you want to do, not how you want to do it.




More information about the R-help mailing list