Displaying 20 results from an estimated 5000 matches similar to: "question about R_ParseVector function"
2007 Jan 17
2
R_ParseVector API change
Dear R developers,
just a quick question: I noted that R_ParseVector () has gained an additional
parameter (since SVN rev. 39999). Since R_ParseVector () is part of the
public API, I'm wondering, whether this API change was intentional or not.
Either way is fine with me, but in order to make sure the next release of
RKWard will be compilable with R 2.5.0, I'd like to make sure,
2019 Jul 13
2
Mitigating Stalls Caused by Call Deparse on Error
When large calls cause errors R may stall for extended periods.? This
is particularly likely to happen with `do.call`, as in this example
with a 24 second stall:
??? x <- runif(1e7)
??? system.time(do.call(paste0, list(abs, x)))? # intentional error
??? ## Error in (function (..., collapse = NULL)? :
??? ##?? cannot coerce type 'builtin' to vector of type 'character'
??? ##
2006 Nov 25
2
Source references from the parser
I have just committed some changes to R-devel (which will become R 2.5.0
next spring) to add source references to parsed R code. Here's a
description of the scheme:
The design is done through 2 old-style classes.
"srcfile" corresponds to a source file: it contains a filename, the
working directory in which that filename is to be interpreted, the last
modified timestamp of the
2009 May 21
3
file descriptor leak in getSrcLines in R 2.10.0 svn 48590
I noticed the following file descriptor leak when I couldn't remove
a package unless I shut down the R session that had loaded and
used it. The function that triggered the problem printed the output
of a call to parse(). Each time one prints a srcref a connection is
opened and not closed. It looks like it happens in
as.character.srcref's
call to getSrcLines, which has some logic I
2019 Jul 14
2
[External] Mitigating Stalls Caused by Call Deparse on Error
Luke, thanks for considering the issue.? I would like to
try to separate the problem into two parts, as I _think_
your comments address primarily part 2 below:
1. How can we avoid significant and possibly crippling
?? stalls on error with these non-standard calls.
2. What is the best way to view these non-standard calls.
I agree that issue 2. requires further thought and
discussion under a
2009 Feb 12
1
Why is srcref of length 6 and not 4 ?
Hello,
Consider this file (/tmp/test.R) :
<file>
f <- function( x, y = 2 ){
z <- x + y
print( z )
}
</file>
I get this in R 2.7.2 :
> p <- parse( "/tmp/test.R" )
> str( attr( p, "srcref" ) )
List of 1
$ :Class 'srcref' atomic [1:4] 1 1 4 1
.. ..- attr(*, "srcfile")=Class 'srcfile' length 4 <environment>
2019 Jul 16
1
[External] Mitigating Stalls Caused by Call Deparse on Error
We also have a few other suggestions and wishes about backtrace
storage and display on the one hand, and display of constructed calls
on the other hand. Perhaps it would be better to open a different
wishlist item for traceback() to keep the discussions focused?
FWIW I think deparsing backtraces lazily is a great idea. Displaying 1
line per call by default in interactive sessions, while being
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
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
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
2016 May 20
2
identical on closures
Specifically, the srcfile attribute of the srcref attribute of the two
instances of the functions contain different environments, AFAICT.
Environments are compared only by exact pointer, so this forces return
FALSE.
Snippets from .Internal(inspect(x)) and .Internal(inspect(y)):
@cca008 03 CLOSXP g0c0 [MARK,NAM(2),ATT]
FORMALS:
@604b58 00 NILSXP g0c0 [MARK,NAM(2)]
BODY:
@cc9650 06 LANGSXP
2013 Dec 13
1
Proper way to drop 'srcref' from an expression created via substitute(function() ...)?
First, why does this expression have a 'srcref' element:
> exprA <- substitute(function(x) a*x, list(a=2))
> print(exprA)
function(x) 2 * x
> str(as.list(exprA))
List of 4
$ : symbol function
$ :Dotted pair list of 1
..$ x: symbol
$ : language 2 * x
$ :Class 'srcref' atomic [1:8] 1 20 1 34 20 34 1 1
.. ..- attr(*, "srcfile")=Classes
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
2016 Mar 13
1
formals(x)<- drops attributes including class
Just checking in to see whether it is intended or not that assigning
new formals to a function/closure causes any attributes to be dropped:
EXAMPLE:
> fcn <- structure(function() {}, foo="foo", class=c("foo"))
> str(fcn)
function ()
- attr(*, "srcref")=Class 'srcref' atomic [1:8] 1 18 1 30 18 30 1 1
.. ..- attr(*, "srcfile")=Classes
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
2014 Mar 05
1
[PATCH] Code coverage support proof of concept
Hello,
I submit a patch for review that implements code coverage tracing in
the R interpreter.
It records the lines that are actually executed and their associated
frequency for which srcref information is available.
I perfectly understands that this patch will not make its way inside R
as it is, that they are many concerns of stability, compatibility,
maintenance and so on.
I would like to have
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
2023 Mar 30
1
removeSource() vs. function literals
Dear R-devel,
In a package of mine, I use removeSource on expression objects in order
to make expressions that are semantically the same serialize to the
same byte sequences:
https://github.com/cran/depcache/blob/854d68a/R/fixup.R#L8-L34
Today I learned that expressions containing function definitions also
contain the source references for the functions, not as an attribute,
but as a separate
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
[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