Displaying 20 results from an estimated 800 matches similar to: "getParseData() for installed packages"
2016 Mar 10
2
getParseData() for installed packages
On 10.03.2016 15:49, Duncan Murdoch wrote:
> On 10/03/2016 8:27 AM, Kirill M?ller wrote:
>> I can't seem to reliably obtain parse data via getParseData() for
>> functions from installed packages. The parse data seems to be available
>> only for the *last* file in the package.
>>
>> See [1] for a small example package with just two functions f and g in
>>
2015 Jul 29
1
Mapping parse tree elements to tokens
As Michael guessed my main use cases was code analysis. A concrete example
where this would help is with my test code coverage tool covr. There is
currently a bug when tracking coverage for if / else statements when the
clauses do not contain brackets (https://github.com/jimhester/covr/issues/39).
Because only one source reference is generated in this case (because it is
parsed as a single
2015 Jul 29
3
Mapping parse tree elements to tokens
Probably need a generic tree based on "ParseNode" objects that
associate the line information with the symbol (for leaf nodes). As
Duncan notes, it should be possible to gather that from the table.
But it would be nice if there was an "expr" column in the parse data
column in addition to "text". It would contain the parsed object.
Otherwise, to use the table, one is
2016 Mar 10
0
getParseData() for installed packages
On 10/03/2016 9:53 AM, Kirill M?ller wrote:
>
> On 10.03.2016 15:49, Duncan Murdoch wrote:
> > On 10/03/2016 8:27 AM, Kirill M?ller wrote:
> >> I can't seem to reliably obtain parse data via getParseData() for
> >> functions from installed packages. The parse data seems to be available
> >> only for the *last* file in the package.
> >>
>
2016 Jul 13
2
Nested tracing with custom callback
Hi all,
I would like to install a trace function that gets executed whenever *any* R function is called. In Python, for example, this functionality is provided by the `sys.settrace` function.
I am not aware of any public interface, at the R or C level, that can accomplish this. The `trace` function is inadequate because it does not support nested functions. The `Rprof` function provides only
2013 Sep 18
1
getParseData() for imaginary numbers
Hi,
The imaginary unit is gone in the 'text' column in the returned data
frame from getParseData(), e.g. in the example below, perhaps the text
should be 1i instead of 1:
> p=parse(text='1i')
> getParseData(p)
line1 col1 line2 col2 id parent token terminal text
1 1 1 1 2 1 2 NUM_CONST TRUE 1
2 1 1 1 2 2 0 expr
2014 Jun 12
1
regression bug with getParseData and/or parse in R-3.1.0
Hi,
With R-3.1.0 I get:
> getParseData(parse(text = "{1}", keep.source = TRUE))
line1 col1 line2 col2 id parent token terminal text
7 1 1 1 3 7 9 expr FALSE
1 1 1 1 1 1 7 '{' TRUE {
2 1 2 1 2 2 3 NUM_CONST TRUE 1
3 1 2 1 2 3 5 expr FALSE
4 1 3 1
2013 Jul 05
3
should the text for RIGHT_ASSIGN be -> in getParseData()?
Hi,
The text column for '->' becomes '<-' in the data frame returned by
getParseData():
> getParseData(parse(text='1->x'))
line1 col1 line2 col2 id parent token terminal text
7 1 1 1 4 7 0 expr FALSE
1 1 1 1 1 1 2 NUM_CONST TRUE 1
2 1 1 1 1 2 7 expr FALSE
3
2017 Sep 06
3
withr::set_makevars
Hi All;
This problem has come about from trying to learn some of the review practices recommend by rOpensci. One of them is to use the package goodpractice. After installing goodpractice, it kept failing on my own packages which are under development, and I was concerned something was funny in my own , so I have a fork of the package rerddap, and I tested goodpractice on that. I get the
2015 Feb 09
3
xtabs and NA
Hi
I haven't found a way to produce a tabulation from factor data with NA
values using xtabs. Please find a minimal example below, it's also on
R-pubs [1]. Tested with R 3.1.2 and R-devel r67720.
It doesn't seem to be documented explicitly that it's not supported.
From reading the code [2] it looks like the relevant call to table()
doesn't set the "useNA"
2017 Sep 07
0
withr::set_makevars
withr:::set_makevars() can give that error if the makefile named by the
'old_path' argument (default "~/.R/Makevars) contains more than one
definition of a variable of the form 'name=value'. You can see what file
it is reading and its contents by using the trace() function:
trace(withr:::set_makevars, quote({ cat(old_path, "\n");
writeLines(paste0(" ",
2016 Dec 16
2
Upgrading a package to which other packages are LinkingTo
Hi
I'd like to suggest to make R more informative when a user updates a
package A where there's at least one package B that has "LinkingTo: A"
in its description.
To illustrate the problem, assume package A is updated so that its C/C++
header interface (in inst/include) is changed. For package B to pick up
these changes, we need to reinstall package A. In extreme cases, if
2017 Jun 06
2
Usage of PROTECT_WITH_INDEX in R-exts
On 06.06.2017 10:07, Martin Maechler wrote:
>>>>>> Kirill M?ller <kirill.mueller at ivt.baug.ethz.ch>
>>>>>> on Mon, 5 Jun 2017 17:30:20 +0200 writes:
> > Hi I've noted a minor inconsistency in the documentation:
> > Current R-exts reads
>
> > s = PROTECT_WITH_INDEX(eval(OS->R_fcall, OS->R_env), &ipx);
2014 Aug 13
1
Request to review a patch for rpart
Dear list
For my work, it would be helpful if rpart worked seamlessly with an
empty model:
library(rpart); rpart(formula=y~0, data=data.frame(y=factor(1:10)))
Currently, an unrelated error (originating from na.rpart) is thrown.
At some point in the near future, I'd like to release a package to CRAN
which uses rpart and relies on that functionality. I have prepared a
patch (minor
2014 Feb 11
2
$new cannot be accessed when running from Rscript and methods package is not loaded
Hi
Accesses the $new method for a class defined in a package fails if the
methods package is not loaded. I have created a test package with the
following single code file:
newTest <- function() {
cl <- get("someClass")
cl$new
}
someClass <- setRefClass("someClass")
(This is similar to code actually used in the testthat package.)
If methods is not loaded,
2014 Jan 25
0
interpreting the output of getParseData()
Hi,
I'm trying to make sense of the output of getParseData(). The "parent" column is supposed to refer to the "id" of the parent of the given item, but there are numbers in the parent column that do not exist in the id column. Example:
> p <- parse(text="f<-function(){if(TRUE)1 else 2}")
> df <- getParseData(p)
> df
line1 col1 line2 col2 id
2017 Jun 09
1
Usage of PROTECT_WITH_INDEX in R-exts
>>>>> Kirill M?ller <kirill.mueller at ivt.baug.ethz.ch>
>>>>> on Thu, 8 Jun 2017 12:55:26 +0200 writes:
> On 06.06.2017 22:14, Kirill M?ller wrote:
>>
>>
>> On 06.06.2017 10:07, Martin Maechler wrote:
>>>>>>>> Kirill M?ller <kirill.mueller at ivt.baug.ethz.ch> on
2015 Jul 29
2
Mapping parse tree elements to tokens
I would like to map the parsed tokens obtained from utils::getParseData()
to the parse tree and elements obtained by base::parse().
It looks like back when this code was in the parser package the parse()
function annotated the elements in the tree with their id, which would
allow you to perform this mapping. However when the code was included in R
this functionality was removed.
?getParseData
2015 Jul 29
2
Mapping parse tree elements to tokens
I have two use cases in mind:
1) Code indexing/searching, where the table gets me almost all of the
way there, except I ask for all of the text (including the calls) and
then parse that, because it's nice to get back an actual code object
when you are searching code (in addition to where the code lives). The
extra parsing step is just a minor inconvenience.
2) Code analysis, which I'm
2020 Apr 22
1
[External] parse data wrong for R 4.0. raw strings
I don't know, maybe it would make sense to keep the whole expression,
that's the text of the tag after all.
Also, if we don't keep the whole expression, then it is not a valid
string literal any more, because it does not have quoting.
I can try to look into a patch. This is for 4.1 I believe, so in some
sense it is not urgent?
Gabor
On Wed, Apr 22, 2020 at 3:31 PM <luke-tierney