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 <simon.pick...@bto.org>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 = NA, nrow = i, ncol = 3, byrow =
> FALSE, dimnames = NULL))
> }
> s1
> s2
> s3
>
> I want to bind all the matrices at the end with do.call(rbind...)  rather
> than listing all the elements manually with rbind(s1,s2,s3...) and so on.
>
> thanks in advance.
>
> Simon.
>
> ______________________________________________
> R-help@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.
>



-- 
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40" S 49° 16' 22" O

        [[alternative HTML version deleted]]

______________________________________________
R-help@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.

Reply via email to