[R] Parse Expression

From: livia <yn19832_at_msn.com>
Date: Mon, 17 Dec 2007 02:54:31 -0800 (PST)

Hello everyone, I would like to construct a datafram with the following command.

eval(parse(text=paste("df=data.frame(", cmd, ")", sep="")))

But it comes out " Error in parse(file, n, text, prompt, srcfile, encoding) :

        syntax error, unexpected $undefined, expecting ',' in
"df=data.frame(cbcDummy10to12 = 1,cbcForeWrld_Ret = 1,cbcYC10-2_"

"cmd" is a character string I obtained before, it is like:

[1] "cbcDummy10to12 = 1,cbcForeWrld_Ret = 1,cbcYC10-2_wld = 1"

Could anyone give me some advice? Many thanks.

View this message in context: http://www.nabble.com/Parse-Expression-tp14370218p14370218.html
Sent from the R help mailing list archive at Nabble.com.

R-help_at_r-project.org mailing list
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Received on Mon 17 Dec 2007 - 10:58:53 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 Mon 17 Dec 2007 - 12:30:19 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.