Skip to content
Prev 312694 / 398506 Next

Line numbers with errors and warnings?

On 12-12-02 9:52 AM, Milan Bouchet-Valat wrote:
Yes, you don't really need to have a file present, you just need a 
srcfile object.  For example, on Windows when you use 
source("clipboard"), there's no file, just the system clipboard.

  If you call fix() on any function, you will
Yes, and then you can call source on that object, and you'll get line 
number information attached, relative to whatever you sourced.


So it
The thing is that if you didn't attach the line number information to 
the code, then it's not there.  R can't figure out after the fact where 
the code came from.  It needs to have the debug info in place when it 
runs it.  How could R figure out where some expression came from that it 
happens to be executing?  Using eval() on a constructed expression in a 
function is not all that uncommon, but to the evaluator, it looks just 
like any other evaluation.
If you're debugging a package, then why not install it with 
keep.source=TRUE?

Duncan Murdoch