[R] combining vectors on unequal length

Nair, Murlidharan T mnair at iusb.edu
Fri Oct 5 14:50:19 CEST 2007


Thanks to all for their suggestions!!
Cheers../Murli


-----Original Message-----
From: Gabor Grothendieck [mailto:ggrothendieck at gmail.com]
Sent: Thursday, October 04, 2007 3:30 PM
To: Nair, Murlidharan T
Cc: r-help at stat.math.ethz.ch
Subject: Re: [R] combining vectors on unequal length

Assuming they are numeric, cbind them as time series:

  as.data.frame(cbind(x = ts(1:10), y = ts(1:5)))

On 10/4/07, Nair, Murlidharan T <mnair at iusb.edu> wrote:
> If I have two vectors
> X<-1:10
> Y<-1:5
> When I combine them using cbind, the shorter one is repeated and both are made of the same length. Is there a methods that does this without duplicating the shorter one. I want to use this to store the data back to a file.
> Thanks ../Murli
>
>
>
>
>        [[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.
>



More information about the R-help mailing list