[R] question about string to boor?

Rolf Turner rolf.turner at xtra.co.nz
Tue Oct 11 01:00:59 CEST 2011


On 11/10/11 08:21, Christoph Molnar wrote:
> Hi Nellie,
>
> hope I got you right. I guess you want something like that.
>
> for (i in 1:7) {
>     oneOfNelliesArray<- eval(parse(text=paste("grp",i, sep="")))
>     anyFunction(oneOfNelliesArray)
> }
>
> Paste() just returns you a string. But you want R to evaluate the
> expression. So you have to parse it and tell R to evaluate it.

But using get() is so much simpler and safer.

     cheers,

         Rolf Turner



More information about the R-help mailing list