[R] evaluation question

Erin Hodgess erinm.hodgess at gmail.com
Tue Nov 22 19:23:13 CET 2011

Dear R People:

Hope you're having a nice day.

Here is a character vector:

> yz
[1] "pexp(3.2,rate=1)"
> str(yz)
 chr "pexp(3.2,rate=1)"
And I would like to evaluate that vector.

I tried:
> eval(as.expression(yz))
[1] "pexp(3.2,rate=1)"

But that doesn't work.

Any suggestions would be most welcome.  I have a feeling that it's
quite simple and that I'm having a forest vs. trees issue.


Erin Hodgess
Associate Professor
Department of Computer and Mathematical Sciences
University of Houston - Downtown
mailto: erinm.hodgess at gmail.com

More information about the R-help mailing list