Re: [R] Combind two different vector

2010-11-27 Thread Gabor Grothendieck
On Sat, Nov 27, 2010 at 1:56 PM, Georg Ruß wrote: > On 27/11/10 19:04:27, Serdar Akin wrote: >>    Hi >>    No its has to be like this: >>    a b >>    1 1 >>    2 2 >>    3 3 >>      4 >>      5 >>      6 > Assuming the empty cells are to be NAs turn a and b into ts objects (since ts objects w

Re: [R] Combind two different vector

2010-11-27 Thread Jorge Ivan Velez
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 on

Re: [R] Combind two different vector

2010-11-27 Thread Georg Ruß
On 27/11/10 19:04:27, Serdar Akin wrote: >Hi >No its has to be like this: >a b >1 1 >2 2 >3 3 > 4 > 5 > 6 Hmm, "empty" elements in such an array? Seems not really recommended, if it's possible at all. You may try filling up the shorter vector with NA's or any

Re: [R] Combind two different vector

2010-11-27 Thread Georg Ruß
On 27/11/10 16:04:35, Serdar Akin wrote: > 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) If that means your output should be (1 2 3 1 2 3 4 5 6) then c <- c(a,b) should solve this. Looks like _the_

[R] Combind two different vector

2010-11-27 Thread Serdar Akin
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 h