Re: [R] problems with 'eval' and 'parse' with strings

From: <Richard.Cotton_at_hsl.gov.uk>
Date: Wed, 02 Apr 2008 18:13:55 +0100


> p="v="
> q=5
> eval(parse(text=paste(p,q,sep="")))
>
> ... then the value of v is 5, OK.
>
> but I can't with strings, for example:
>
> p="v="
> q="hello friend"
> eval(parse(text=paste(p,q,sep="")))
>
> ...... error

Try:
eval(parse(text=paste(p,"'",q,"'",sep="")))

Regards,
Richie.

Mathematical Sciences Unit
HSL



ATTENTION: This message contains privileged and confidential inform...{{dropped:20}}

R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Wed 02 Apr 2008 - 17:20:12 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 Wed 02 Apr 2008 - 17:30:26 GMT.

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

list of date sections of archive