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

Richard.Cotton at hsl.gov.uk Richard.Cotton at hsl.gov.uk
Wed Apr 2 19:13:55 CEST 2008


> 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}}



More information about the R-help mailing list