[R] Parser For Line Number Tracing

Ivo Welch |vo@we|ch @end|ng |rom gm@||@com
Sun Jan 19 01:09:02 CET 2025


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 <ikwsimmo using gmail.com> wrote:
>
> 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,
>     Iris
>
> On Sat, Jan 18, 2025 at 6:41 PM Ivo Welch <ivo.welch using gmail.com> 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 like to have is a parser that inserted 'curline
> > <<- ##' into the R code, where '##' is the filename and line number.
> > something like 'addtracker one.R two.R' and thereafter I can run two.R
> > and, when the program dies, use `print curline` to find out where my
> > error has roughly occurred.
> >
> > has someone already written such an 'instrumenter'?
> >
> > ______________________________________________
> > R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide https://www.R-project.org/posting-guide.html
> > and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list