Re: [R] creating a list of matrices or data frames

2009-01-20 Thread hadley wickham
On Tue, Jan 20, 2009 at 10:34 AM, Simon Pickett wrote: > Hi all, > > How would you create a list of data.frames within a loop, then bind all the > elements of the list using rbind? > > take this example of matrices with differing numbers of rows > > for(i in 1:3){ > assign(paste("s",i, sep=""),mat

Re: [R] creating a list of matrices or data frames

2009-01-20 Thread Henrique Dallazuanna
Try this also: lapply(1:3, matrix, data = NA, ncol = 3, byrow = F, dimnames = NULL) do.call(rbind, lapply(1:3, matrix, data = NA, ncol = 3, byrow = F, dimnames = NULL)) On Tue, Jan 20, 2009 at 2:34 PM, Simon Pickett wrote: > Hi all, > > How would you create a list of data.frames within a loop, t

Re: [R] creating a list of matrices or data frames

2009-01-20 Thread Chuck Cleland
On 1/20/2009 11:34 AM, Simon Pickett wrote: > Hi all, > > How would you create a list of data.frames within a loop, then bind all > the elements of the list using rbind? > > take this example of matrices with differing numbers of rows > > for(i in 1:3){ > assign(paste("s",i, sep=""),matrix(data

[R] creating a list of matrices or data frames

2009-01-20 Thread Simon Pickett
Hi all, How would you create a list of data.frames within a loop, then bind all the elements of the list using rbind? take this example of matrices with differing numbers of rows for(i in 1:3){ assign(paste("s",i, sep=""),matrix(data = NA, nrow = i, ncol = 3, byrow = FALSE, dimnames = NULL))