Re: [R] Reference variables by string in for loop

From: Michael Bach <phaebz_at_gmail.com>
Date: Fri, 29 Apr 2011 15:04:00 +0300

"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



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. Received on Fri 29 Apr 2011 - 12:11:09 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 29 Apr 2011 - 12:50:35 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive