On Nov 30, 2012, at 1:22 PM, Worik R 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.

Generally if one is in an interactive mode, one is advised to use the error 
recovery process provided by:

 options(error=recover)

You should then be dropped into the browser in the environment of the error. 
Execute ls() to see what variables are accessible in the local environment. So 
you also need to consult:

?browser


-- 

David Winsemius, MD
Alameda, CA, USA

______________________________________________
R-help@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.

Reply via email to