[Rd] problem with parse(text=quote(name))

Prof Brian Ripley ripley at stats.ox.ac.uk
Fri Mar 19 15:05:19 CET 2010


This comes from bolting on srcrefs: as.character() was used for 
srcrefs, but *not* for coercion (as documented), and quote(myName) was 
coerced to NULL.

The simplest way out is to use text <- as.character(text) early on.
Maybe coerceVector should handle symbols, though.

On Fri, 12 Mar 2010, William Dunlap wrote:

> Calling parse(text=quote(name)) or text=as.name("name")
> makes parse() prompt for input from the command line
> and then it returns a parse of the initial characters
> of 'name' (depending on how many characters were typed
> at the prompt).   E.g.,
>
>   > parse(text=quote(myName))
>   ?1/3
>   expression(myN)
>   attr(,"srcfile")
>   <text>
>   > parse(text=quote(myName))
>   ?1/34
>   expression(myNa)
>   attr(,"srcfile")
>   <text>
>   > parse(text=quote(myName))
>   ?1/345
>   expression(myNam)
>   attr(,"srcfile")
>   <text>
>
> where the ? lines are where parse prompted for input
> and I typed a valid R expression.
>
> I ran into this when starting to convert code that used
> a deparse/parse cycle to avoid the cycle by storing the
> expressions themselves and I hadn't yet taken out one
> of the calls to parse(text=myText).
>
> I see it in 2.10.1 and "R version 2.11.0 Under development
> (unstable) (2010-03-07 r51225)."
>
> Bill Dunlap
> Spotfire, TIBCO Software
> wdunlap tibco.com
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



More information about the R-devel mailing list