[R] How to make an array of data.frames?

Gabor Grothendieck ggrothendieck at gmail.com
Sun Aug 26 18:26:13 CEST 2007


Is this what you want:

DF1 <- DF2 <- DF3 <- df1 <- df2 <- df3 <- head(iris)
list(a = list(DF1, DF2, DF3), b = list(df1, df2, df3))

or

x <- list()
x$a <- list(DF1, DF2, DF3)
x$b <- list(df1, df2, df3)


On 8/26/07, Werner Wernersen <pensterfuzzer at yahoo.de> wrote:
> Hi,
>
> I am still struggling with the data structures in R. I
> know how it works in C++ but how can I get such a
> structure in R?
>
> Here is what I want:
> x["a"]$dataframe1
> x["a"]$dataframe2
> x["a"]$dataframe3
> x["b"]$dataframe1
> x["b"]$dataframe2
> x["b"]$dataframe3
> x["c"]$dataframe1
> x["c"]$dataframe2
> x["c"]$dataframe3
>
> And it would be nice if I could fill in "objects" a,
> b, c one at a time successively.
>
> What is the easiest way to get such a data structure?
> It would be great if someone could give me some help
> with this.
>
> Many thanks and kind regards,
>  Werner
>
> ______________________________________________
> R-help at stat.math.ethz.ch 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.
>



More information about the R-help mailing list