[R] rbind-ing vectors inside lists

Gabor Grothendieck ggrothendieck at gmail.com
Thu Aug 17 19:53:33 CEST 2006


Try:

mapply(rbind, a, b, SIMPLIFY = FALSE)


On 8/17/06, Domenico Vistocco <vistocco at unicas.it> wrote:
> Dear helpeRs,
>
> suppose I have two lists as follows:
>
> a = list(1:5,5:9)
> b = lapply(a,"*",2)
>
>
> I would like to rbind-ing the two lists, that is I would like to use
> something as rbind applied
> component to component for the two list.
>
> I have used the following solution:
>
> fun.tile.wt = function(list1, list2)
> {
>         for(i in 1:length(list1))
>         {
>                 list1[[i]]=rbind(list1[[i]],list2[[i]])
>         }
>         list1
> }
> fun.tile.wt(a,b)
>
>
> Is it possible to directly obtain the result using the apply family
> (or something else)?
>
> Any suggestions is appreciated.
>
> Thanks in advance,
> domenico vistocco
>        [[alternative HTML version deleted]]
>
>
> Chiacchiera con i tuoi amici in tempo reale!
>  http://it.yahoo.com/mail_it/foot/*http://it.messenger.yahoo.com
>
> ______________________________________________
> 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
> and provide commented, minimal, self-contained, reproducible code.
>



More information about the R-help mailing list