[R] Line numbers in error messages
Duncan Murdoch
dmurdoch at pair.com
Tue Apr 13 01:41:05 CEST 2004
On Mon, 12 Apr 2004 15:20:58 -0700, you wrote:
>Hi Patrick,
>
>>It's very simple using a browser() line in your function somewhere you
>>know your code's OK, then run line by line.
>>
>The problem is that sometimes you have code of a few hundred lines, to
>which you have added a strange little line that craps out because of
>some silly mistake that would be apparent if you knew which line to look
>at. However.... you don't want to start inserting browser statements
>inside the code, hoping to get close, you just want to know what line
>caused the issue.
This is something that's on my wish list too, but it would require
fairly low-level changes. Right now the parser doesn't record source
file information on a line, so there's no way an error message could
report it.
It's not absolutely obvious how to do it, either: code can come from
files, from saved images, from stuff you typed at the console prompt,
from a connection, as the result of evaluating an expression, etc.
It's a lot more complicated to do this in an interpreted language like
R than in a compiled language.
Duncan Murdoch
More information about the R-help
mailing list