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

2008-04-02 Thread salcaraz
Hi R-friends:

I don't understand very well the parser.

if I do:

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

and, I would need that v has the value hello friend

Could anyone help me, please?

Thank you in advance

/salva

__
R-help@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.


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

2008-04-02 Thread Richard . Cotton
 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@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.