Re: [R] Is there a way to get R script line number

2017-04-07 Thread MacQueen, Don
Possible clarification/correction...(apologies in advance if I'm being redundant) If I put the following four lines in a script whose file name is "junk.r": log(3) log(4) log('a') log(5) then it generates an error message, as expected: > source('junk.r') Error in log("a") (from junk.r#3) : non

Re: [R] Is there a way to get R script line number

2017-04-07 Thread William Michels via R-help
Hi Brad, Some of the debugging functions may be of use. You can look at trace() or setBreakpoint(). But I believe Bert is correct in saying your concept of a "Line Number" and R's concept of a "Line Number" will differ. Finally, you can look at the function findLineNum(), which can be called exte

Re: [R] Is there a way to get R script line number

2017-04-06 Thread Bert Gunter
I believe the answer is: No. "Line number" is an ambiguous concept. Does it mean physical line on a display of a given width? a line of code demarcated by e.g. ; a step in the execution of script (that might display over several physical lines?) However, various IDE's have and display "line numbe

[R] Is there a way to get R script line number

2017-04-06 Thread Brad P
Hello, Is there a way to get the current line number in an R script? As a silly example, if I have the following script and a function called getLineNumber (suppose one exists!), then the result would be 3. 1 # This is start of script 2 3 print( getLineNumber() ) 4 5 # End of script Thanks for