[R] Quick data-manipulation question

Wiener, Matthew matthew_wiener at merck.com
Thu Oct 28 15:57:52 CEST 2004


Sean --

You want do.call("rbind", your.list.of.data.frames).  do.call is helpful in
a lot of situations when you want to construct a list of arguments and then
apply a function.

Hope this helps,

Matt Wiener

-----Original Message-----
From: r-help-bounces at stat.math.ethz.ch
[mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Sean Davis
Sent: Thursday, October 28, 2004 9:30 AM
To: r-help
Subject: [R] Quick data-manipulation question


I have a list of data frames and I want to concatenate them into a 
single data frame, basically appending all of the data frames to each 
other (they are all the same shape, in terms of columns).  I'm looking 
for a nice way to do that.  I can of course just consecutively rbind 
them to a "master" dataframe, but I have 22,000 such data frames, each 
with a few hundred rows, so this process takes a good while.  Should be 
simple, I imagine....

Here is a toy data structure.
j <- list()
for (i in letters[1:26]) {j[[i]] <- 
data.frame(rep(i,25),matrix(rnorm(250),nrow=25))}

Thanks.

Sean

______________________________________________
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




More information about the R-help mailing list