Hi Serdar,

One way would be:

l <- list(a, b)
do.call(cbind, lapply(l, function(x) x[1:max(sapply(l, length))]))

HTH,
Jorge


On Sat, Nov 27, 2010 at 10:04 AM, Serdar Akin <> wrote:

> Hi
>
> I'm trying two combine two vectors that have different lengths. This
> without
> recursive the shorter one. E.g.,
>
> a <- seq(1:3)
> b <- seq(1:6)
>
> Thanks in advance
>
> Serdar
>
>        [[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.
>

        [[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