[R] evaluation question

R. Michael Weylandt michael.weylandt at gmail.com
Tue Nov 22 19:31:31 CET 2011


Good morning Erin,

eval(parse(text = "pexp(3.2,rate=1)"))

seems to work

But the general rule applies:

library(fortunes)
fortune("parse()")

Best,

Michael

On Tue, Nov 22, 2011 at 1:23 PM, Erin Hodgess <erinm.hodgess at gmail.com> wrote:
> 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.
>
> Thanks,
> Erin
>
>
> --
> Erin Hodgess
> Associate Professor
> Department of Computer and Mathematical Sciences
> University of Houston - Downtown
> mailto: erinm.hodgess at gmail.com
>
> ______________________________________________
> R-help at 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.



More information about the R-help mailing list