[R] "Executing" a string

Peter Dalgaard BSA p.dalgaard at biostat.ku.dk
Wed Oct 11 13:42:59 CEST 2000

Thomas Hoffmann <hoffmann at ehmgs2.et.tu-dresden.de> writes:

> In Matlab or Octave I can evaluate (evalf) the content of
> a string. In R I have looked around in the docs, but have not 
> found a way to do something equivalent (which is possible, I think).
> Can anybody give me a pointer?

> eval(parse(text="2+2"))
[1] 4

Also check out substitute(), as.name() et al. for other methods of
manipulating expressions and function calls

   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)             FAX: (+45) 35327907
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch

More information about the R-help mailing list