[R] "Executing" a string

Mark Myatt mark at myatt.demon.co.uk
Wed Oct 11 15:09:12 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?
>

Use the eval(parse()) pairing:

        String2Eval <- "A valid R statement"
        eval(parse(text = String2Eval)) 

Hope that does the trick.




--
Mark Myatt


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