[R] Simple question on eval
Lamke
lamkelf at gmail.com
Tue Nov 30 23:24:35 CET 2010
Hi group,
I did some searches about this very simple question. Hope someone can help
me out.
If I have the following:
a <- "x <- 2^2"
a
[1] "x <- 2^2"
How do I evaluate the expression that gets me an answer of 4? I tried the
following:
> eval(a)
[1] "x <- 2^2"
> get(a)
Error in get(a) : object 'x <- 2^2' not found (apparently it's not right!!)
I have one long string of commands separated by semi-colon and hope to sort
it out. Thank you so much!!!
Kel
--
View this message in context: http://r.789695.n4.nabble.com/Simple-question-on-eval-tp3066346p3066346.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list