Re: [R] Parser For Line Number Tracing

2025-01-21 Thread Dr Eberhard Lisse
On 2025/01/19 01:41, Ivo Welch wrote: > I often find myself hunting where in my program an error has happened, > (of course, in R, many error messages are mysterious in themselves, > too, making it even harder.) the way I do it is mostly with inserting > `message()` statements. tried something li

Re: [R] Parser For Line Number Tracing

2025-01-19 Thread Duncan Murdoch
I think I considered doing that many years ago, but one or more of the following stopped me: - It will mess up old test scripts that are checking for the old format error messages. - Some errors are due to a severe lack of resources (e.g. full stack, out of some other kind of memory, etc.)

Re: [R] Parser For Line Number Tracing

2025-01-19 Thread Ivo Welch
Hi Duncan — Wonderful. Thank you. Bug or no bug, I think it would be a huge improvement for user-friendliness if R printed the last line by default *every time* a script dies. Most computer languages do so. Should I file it as a request for improvement to the R code development team? Maybe R c

Re: [R] Parser For Line Number Tracing

2025-01-19 Thread Duncan Murdoch
On 2025-01-18 8:27 p.m., Ivo Welch wrote: I am afraid my errors are worse! (so are my postings. I should have given an example.) ``` x <- 1 y <- 2 nofunction("something stupid I am doing!") z <- 4 ``` and ``` source("where-is-my-water.R") Error in nofunction("something stupid I am doing!")

Re: [R] Parser For Line Number Tracing

2025-01-18 Thread Ivo Welch
I am afraid my errors are worse! (so are my postings. I should have given an example.) ``` x <- 1 y <- 2 nofunction("something stupid I am doing!") z <- 4 ``` and ``` > source("where-is-my-water.R") Error in nofunction("something stupid I am doing!") : could not find function "nofunction" ``

Re: [R] Parser For Line Number Tracing

2025-01-18 Thread Duncan Murdoch
On 2025-01-18 6:41 p.m., Ivo Welch wrote: I often find myself hunting where in my program an error has happened, (of course, in R, many error messages are mysterious in themselves, too, making it even harder.) the way I do it is mostly with inserting `message()` statements. what I would really

Re: [R] Parser For Line Number Tracing

2025-01-18 Thread Jeff Newmiller via R-help
I recommend making sure your code is built with functions and using the debugger and breakpoints (e.g. [1]) to follow the flow of the code to lead you to where your problem is. If you are used to building thousand-line top-level scripts then you might not welcome this suggestion, but in that yo

Re: [R] Parser For Line Number Tracing

2025-01-18 Thread Iris Simmons
Hi Ivo, I maintain 'package:this.path' that I believe does what you want. I regularly add this to my own code when I need to: warning(sprintf("remove this later at %s#%d", this.path::try.this.path(), this.path::LINENO()), call. = FALSE, immediate. = TRUE) Of course, modify as needed. Regards,

Re: [R] Parser For Line Number Tracing

2025-01-18 Thread Ivo Welch
great. wonderful. will check it out, and hopefully widely recommend it (to my students, too). Non-descriptive R error messages have had most of our school abandon R in favor of python. :-( On Sat, Jan 18, 2025 at 3:46 PM Iris Simmons wrote: > > Hi Ivo, > > > I maintain 'package:this.path' tha

[R] Parser For Line Number Tracing

2025-01-18 Thread Ivo Welch
I often find myself hunting where in my program an error has happened, (of course, in R, many error messages are mysterious in themselves, too, making it even harder.) the way I do it is mostly with inserting `message()` statements. what I would really like to have is a parser that inserted 'curl