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

From: Prof Brian Ripley <ripley_at_stats.ox.ac.uk>
Date: Fri, 19 Mar 2010 14:05:19 +0000 (GMT)

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

______________________________________________
R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Received on Fri 19 Mar 2010 - 14:09:14 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 19 Mar 2010 - 20:01:11 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.

list of date sections of archive