On 28/01/2010, at 2:59 AM, Joe Trubisz wrote:

Hello...

In other languages (e.g. php, perl), you have the ability to create a
valid string and execute the string to get the result. For example (in
pseudo-R):

S<-"which(m==4)"
R<-exec(S)

I know this does not work, but was wondering if there was an
equivalent mechanism that I cannot find in the docs anywhere to make
it work.

> set.seed(42)
> m <- sample(0:9,42,TRUE)
> S <- "which(m==4)"
> eval(parse(text=S))
[1] 11 15 19 29 42

        cheers,

                Rolf Turner


######################################################################
Attention:\ This e-mail message is privileged and confid...{{dropped:9}}

______________________________________________
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.

Reply via email to