[R] extracting objects from lists
jim holtman
jholtman at gmail.com
Tue Sep 14 21:50:59 CEST 2010
First create a list of the dataframe and then do the loop:
myList <- list(d1, d2, d3, d4, d5)
for (i in myList) print(i)
or
for (i in seq(length(myList))) print(myList[[i]])
On Tue, Sep 14, 2010 at 2:13 PM, lord12 <gaut222 at yahoo.com> wrote:
>
> If you have 5 data frames and you append them to a list, how do you access
> the first data frame, not the first value of the first data frame while
> iterating in a for loop?
>
> list = c(d1,d2,d3,d4,d5) where d1..d5 are dataframes.
> for(i in 1: length(list)){
> print(list[1])
> }
> --
> View this message in context: http://r.789695.n4.nabble.com/extracting-objects-from-lists-tp2539412p2539412.html
> Sent from the R help mailing list archive at Nabble.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.
>
--
Jim Holtman
Cincinnati, OH
+1 513 646 9390
What is the problem that you are trying to solve?
More information about the R-help
mailing list