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
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
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
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
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
2017 Dec 11
1
possible bug in utils::removeSource - NULL argument is silently dropped
Dear R-Core Team,
I found an unexpected behaviour in utils::removeSource (also present in
r-devel as of today).
---
# create a function which accepts NULL argument
foo <- function(x, y) {
if (is.null(y)) y <- "default foo"
attr(x, "foo") <- y
x
}
# create a function which utilizes 'foo'
testSrc <- function() {
x <- 1:3
x <- foo(x,
2009 Oct 30
1
.Rprofile replacement function setwd() causing errors
In my .Rprofile I have the following functions which display the
current directory in the main R window title bar,
and modify base::setwd() to keep this up to date. I like this because I
can always tell where I am in the file system.
cd <- function(dir) {
base::setwd(dir)
utils::setWindowTitle( short.path(base::getwd()) )
}
short.path <- function(dir, len=2) {
np
2023 Mar 31
2
removeSource() vs. function literals
If you can afford a dependency on rlang, `rlang::zap_srcref()` deals
with this. It's recursive over expression vectors, calls (including
calls to `function` and their hidden srcref arg), and function
objects. It's implemented in C for efficiency as we found it to be a
bottleneck in some applications (IIRC caching). I'd be happy to
upstream this in base if R core is interested.
Best,
2023 Mar 30
2
removeSource() vs. function literals
On 30/03/2023 10:32 a.m., Ivan Krylov wrote:
> 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
>
2012 Jan 11
1
parse( connection) and source-keeping
In R <= 2.13.x, calling 'parse( con)' where 'con' is a connection, 'options( keep.source)' is TRUE, and default 'srcfile' would preserve the source. In R >= 2.14.1, it doesn't.
> tf <- tempfile()
> options( keep.source=TRUE)
> texto <- c( 'function() { # comment', '}')
> parse( text=texto)
expression(function() { #
2019 Dec 14
1
Inconsistent behavior for the C AP's R_ParseVector() ?
Hi Simon,
Widespread errors would have caught my earlier as the way that code is
using only one initialization of the embedded R, is used quite a bit, and
is covered by quite a few unit tests. This is the only situation I am aware
of in which an error occurs.
What is a "correct context", or initial context, the code should from ?
Searching for "context" in the R-exts manual
2009 Jun 18
1
R_parseVector and syntax error [was: error messages while parsing with rniParse]
Hello,
[I'm redirecting this here from stats-rosuda-devel]
When parsing R code through R_parseVector and the code generates an
error (syntax error), is there a way to grab the error.
It looks like yyerror populates the buffer "R_ParseErrorMsg", but then
the variable is not part of the public api.
Would it be possible to add yet another entry point to the parser that
would
2019 Dec 14
2
Inconsistent behavior for the C AP's R_ParseVector() ?
Le lun. 9 d?c. 2019 ? 09:57, Tomas Kalibera <tomas.kalibera at gmail.com> a
?crit :
> On 12/9/19 2:54 PM, Laurent Gautier wrote:
>
>
>
> Le lun. 9 d?c. 2019 ? 05:43, Tomas Kalibera <tomas.kalibera at gmail.com> a
> ?crit :
>
>> On 12/7/19 10:32 PM, Laurent Gautier wrote:
>>
>> Thanks for the quick response Tomas.
>>
>> The same error