[R] Reference variables by string in for loop

Michael Bach phaebz at gmail.com
Fri Apr 29 14:04:00 CEST 2011

"Nick Sabbe" <nick.sabbe at ugent.be> writes:

> ObjectsOfInterest<- list(one_df, two_df, three_df)
> for(namedf in ObjectsOfInterest){...}

I see. This is also more readable and traceable for others.

> or probably even better
> sapply(ObjectsOfInterest, function(namedf){...})

I like this one for its functional style.

> hth.

It did, thanks.

Kind Regards,
Michael Bach

More information about the R-help mailing list