Displaying 20 results from an estimated 9000 matches similar to: "Parser For Line Number Tracing"
2025 Jan 18
1
Parser For Line Number Tracing
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 at gmail.com>
2025 Jan 19
1
Parser For Line Number Tracing
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 like to have is a parser that inserted 'curline
> <<-
2025 Jan 19
2
Parser For Line Number Tracing
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 can be improved at a very low cost to the
development team and a very high benefit to newbies.
2025 Jan 19
3
[External] Re: Parser For Line Number Tracing
On Sun, 19 Jan 2025, Ivo Welch wrote:
> 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 can be improved at a very low cost
2025 Jan 19
1
[External] Re: Parser For Line Number Tracing
Thanks for pointing out the options.  Using
    options(show.error.locations = TRUE)
works on Ivo's example, but it doesn't show a location if the error 
happens in a function that doesn't have srcrefs, because the known 
location isn't on the top of the stack.
Perhaps TRUE (and maybe "top"?) should look back through the stack until 
it finds a known location, and
2025 Jan 20
2
[External] Re: Parser For Line Number Tracing
I've posted a patch to bugs.r-project.org that fixes the traceback() 
issue.  It's not specific to findFun3; you get the same problem with 
errors from expressions like
  1 + "a"
In my testing, I occasionally saw cases where show.error.locations = 
TRUE didn't work.  I'll try to track down a reproducible case, and 
perhaps a patch to fix it.
Duncan Murdoch
On
2025 Jan 19
1
[External] Re: Parser For Line Number Tracing
understood.
but, please, consider not people like me but unwary beginners and
students of R.  I have used R now for decades, and even I am baffled
by it.  Couldn't you make R code easier to debug not only for people
like me (who can indeed tweak their environments) but also for novice
users?
On Sun, Jan 19, 2025 at 8:46?AM <luke-tierney at uiowa.edu> wrote:
>
> On Sun, 19 Jan
2025 Jan 19
1
[External] Re: Parser For Line Number Tracing
Avi,
Yes, R (really S) was not designed for novice users but rather for experts. For better or worse it has evolved into a programming language used by tyros, and experts. Debugging tools should be easy to use, generally known, and helpful for tyro and expert.  It would certainly help if R reported the line number, or the code, that generated the error.
John
John David Sorkin M.D., Ph.D.
2025 Jan 20
1
[External] Re: Parser For Line Number Tracing
Sorry, I'm not seeing the first problem now: 
options(show.error.locations = TRUE) works fine.  Not sure what I did 
wrong before.
I'm still seeing `traceback()` failing to report the attempt to call 
nofunction().  I suppose this is because a context is never set up for 
the failed call.  Perhaps findFun3 could set up a fake context so that 
traceback() adds one more entry?
Duncan
2025 Jan 19
1
[External] Re: Parser For Line Number Tracing
Arguably, R was not designed or evolved for truly novice users, nor really was Python or just about all computer languages. As they evolved and became in many ways more powerful, they tended to get ever less user friendly in the way you are asking for and gotten so bloated that many features are not familiar even to expert users.
Compiled languages can have ways to keep track of what LINE of code
2025 Jan 21
1
[External] Re: Parser For Line Number Tracing
And now I've found the elusive bug in show.error.locations = TRUE as 
well, and posted a patch for that too.
Back to the original topic of this thread:  I think most users should 
routinely use
  options(show.error.locations = TRUE)
e.g. in their .Rprofile.
That will often speed up bug fixes, especially if my patch is incorporated.
Duncan Murdoch
On 2025-01-20 5:56 p.m., Duncan Murdoch
2025 Jan 19
1
Parser For Line Number Tracing
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
2025 Jan 19
1
Parser For Line Number Tracing
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"
```
and no traceback is available.
2010 Nov 24
1
segfault interest?
in a long program, I ran into
?*** caught segfault ***
address 0xdc3f9b48, cause 'memory not mapped'
Traceback:
?1: rep.int(seq_len(nx), rep.int(rep.fac, nx))
?2: rep.int(rep.int(seq_len(nx), rep.int(rep.fac, nx)), orep)
?3: expand.grid(seq_len(nx), seq_len(ny))
?4: merge.data.frame(d, ss)
?5: merge(d, ss)
?6: valid.range(opt)
?7: eval.with.vis(expr, envir, enclos)
?8: eval.with.vis(ei,
2011 Oct 10
5
multicore by(), like mclapply?
dear r experts---Is there a multicore equivalent of by(), just like
mclapply() is the multicore equivalent of lapply()?
if not, is there a fast way to convert a data.table into a list based
on a column that lapply and mclapply can consume?
advice appreciated...as always.
regards,
/iaw
----
Ivo Welch (ivo.welch at gmail.com)
2012 Mar 30
4
list assignment syntax?
Dear R wizards:  is there a clean way to assign to elements in a list?
 what I would like to do, in pseudo R+perl notation is
 f <- function(a,b) list(a+b,a-b)
 (c,d) <- f(1,2)
and have c be assigned 1+2 and d be assigned 1-2.  right now, I use the clunky
  x <- f(1,2)
  c <- x[[1]]
  d <- x[[2]]
  rm(x)
which seems awful.  is there a nicer syntax?
regards, /iaw
----
Ivo Welch
2013 Apr 04
6
categorized complete list of R commands?
every time I read the R release notes for the next release, I see many
functions that I had forgotten about and many functions that I never knew
existed to begin with.  (who knew there were bibtex facilities in R?
 obviously, everyone except me.)
I wonder whether there is a complete list of all R commands (incl the
standard packages) somewhere, preferably each with its one-liner AND
2013 Feb 07
4
Hard Stop?
is it possible to throw a stop() that is so hard that it will escape
even tryCatch?
/iaw
----
Ivo Welch (ivo.welch at gmail.com)
2010 Jan 08
4
fast lm se?
dear R experts---I am using the coef() function to pick off the coefficients
from an lm() object.  alas, I also need the standard errors and I need them
fast.  I know I can do a "summary()" on the object and pick them off this
way, but this computes other stuff I do not need.  Or, I can compute (X'
X)^(-1) s^2 myself.  Has someone written a fast se() function?
incidentally, I think
2011 Jul 02
5
%dopar% parallel processing experiment
dear R experts---
I am experimenting with multicore processing, so far with pretty
disappointing results.  Here is my simple example:
A <- 100000
randvalues <- abs(rnorm(A))
minfn <- function( x, i ) { log(abs(x))+x^3+i/A+randvalues[i] } ?## an
arbitrary function
ARGV <- commandArgs(trailingOnly=TRUE)
if (ARGV[1] == "do-onecore") {
  ?library(foreach)
  ?discard <-