[R] Create vector of data frames

From: Brigid Mooney <bkmooney_at_gmail.com>
Date: Wed, 19 Nov 2008 11:27:27 -0500

Hi All,

I'm sorry I haven't been able to find anything that will help me with this problem, and I'm still pretty new to R - so any help here is greatly appreciated!

I am looking to create a vector in a sequential process where each entry in the vector is a data frame, for example:

days <- 3
for (i in 1:days)
    FOO[i] <- data.frame(x=c(i, i+1, i+2), y=c(i, i*i, i*i*i))   }

but when I try this, I get the error "object "FOO" not found".

I tried to avoid this by concatenating blank data frames to create a shell for FOO via:

FOO <- rep(data.frame(), times=days)

before the other lines, but then I get lots of errors relating to replacing 0 rows with 3 rows.

Needless to say, the data frames I am actually dealing with are quite a bit larger than listed here - so I wanted to get the process working on a toy example first.

Thanks in advance for your help!

for (i in 1:3)

        [[alternative HTML version deleted]]

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 Wed 19 Nov 2008 - 16:29:55 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 Wed 19 Nov 2008 - 17:30:28 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