Try this:

t(sapply(l, '[', 1:max(sapply(l, length))))

On Mon, Nov 8, 2010 at 5:05 PM, johannes rara <johannesr...@gmail.com>wrote:

> Hi,
>
> How to rbind these vectors from a list?:
>
> > l <- list(a = c(1, 2), b = c(1, 2, 3))
> > l
> $a
> [1] 1 2
>
> $b
> [1] 1 2 3
>
> > do.call(rbind, l)
>  [,1] [,2] [,3]
> a    1    2    1
> b    1    2    3
> Warning message:
> In function (..., deparse.level = 1)  :
>  number of columns of result is not a multiple of vector length (arg 1)
> >
>
> -J
>
> ______________________________________________
> 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