[R] combining vectors on unequal length

Julian Burgos jmburgos at u.washington.edu
Thu Oct 4 22:41:22 CEST 2007

Well, if you bind two vectors you form an array with dimensions 2 x 
length of the longest vector.  So you need to decide how to fill up the 
'empty' spacies corresponding to the shorter vector.  Recycling the 
shorter vector is the default action.

If you just want to save the data, you could create a list and save it 
as a R object.



Nair, Murlidharan T 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