Is there an efficient way to use rbind() with the five dataframes described in the following example: a <- c(1:5) list.foo <- lapply(a, function(x) data.frame(beta=a*rnorm(10), deta=a*rnorm(10))) big.data.frame <- rbind(list.foo[[1]], list.foo[[2]], list.foo[[3]], list.foo[[4]], list.foo[[5]]) #is there an easier method? For example, I naively thought you could do something like rbind(list.foo[[1:5]]) #gives an error message but that results in an error message. Thanks, Andrew [[alternative HTML version deleted]]
do.call(rbind, list.foo) On Fri, 18 Apr 2008, Andrew Yee wrote:> Is there an efficient way to use rbind() with the five dataframes described > in the following example: > > a <- c(1:5) > list.foo <- lapply(a, function(x) data.frame(beta=a*rnorm(10), > deta=a*rnorm(10))) > big.data.frame <- rbind(list.foo[[1]], list.foo[[2]], list.foo[[3]], > list.foo[[4]], list.foo[[5]]) #is there an easier method? > > For example, I naively thought you could do something like > > rbind(list.foo[[1:5]]) #gives an error message > > but that results in an error message. > > Thanks, > Andrew > > [[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. >
Thanks! On 4/18/08, Katharine Mullen <kate at few.vu.nl> wrote:> do.call(rbind, list.foo) > > On Fri, 18 Apr 2008, Andrew Yee wrote: > > > Is there an efficient way to use rbind() with the five dataframes > described > > in the following example: > > > > a <- c(1:5) > > list.foo <- lapply(a, function(x) data.frame(beta=a*rnorm(10), > > deta=a*rnorm(10))) > > big.data.frame <- rbind(list.foo[[1]], list.foo[[2]], list.foo[[3]], > > list.foo[[4]], list.foo[[5]]) #is there an easier method? > > > > For example, I naively thought you could do something like > > > > rbind(list.foo[[1:5]]) #gives an error message > > > > but that results in an error message. > > > > Thanks, > > Andrew > > > > [[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. > > >-- Sent from Gmail for mobile | mobile.google.com