[R] rbind for a list

Henrique Dallazuanna wwwhsd at gmail.com
Tue Sep 29 19:51:34 CEST 2009


Try this;

do.call(rbind, sapply(gg2, '[', 1))

On Tue, Sep 29, 2009 at 2:43 PM, Carlos Hernandez <carlos.uni2 at gmail.com> wrote:
> Dear All,
> I´m using the following code:
>
> all1<-gg2[[1]][[1]]; for(i in 1:48){ all1 <- rbind(all1,gg2[[i]][[1]]) }
>
> to create a new matrix that contains all the matrices in a list called gg2.
> gg2 is a list that looks like
>
>>> gg2
> [[1]]
> [[1]][[1]]
> <matrix one>
>
> [[2]]
> [[2]][[1]]
> <matrix two>
> .
> .
> .
> [[48]]
> [[48]][[1]]
> <matrix 48>
>
> Is there a faster way to do the rbind?
>
> i've tried do.call("rbind",gg2) but does not work.
>
> Thank you for any hints or advice!
>
> Best regards,
> Carlos
>
>        [[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.
>
>



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




More information about the R-help mailing list