[R] combining vectors on unequal length

Gabor Grothendieck ggrothendieck at gmail.com
Thu Oct 4 21:30:23 CEST 2007


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