[R] evaluate a string variable

Jeremiah H. Savage jeremiahsavage at gmail.com
Wed Jun 30 07:45:25 CEST 2010


Hello,

I was wondering how to evaluate a string variable in R.

eg.

> avar <- "getwd()"
> eval(avar)

gives:
[1] "getwd()"

but I would like to see:
[1] "/home/myhomedir"

Thanks,
Jeremiah



More information about the R-help mailing list