Sorry if this is already answered somewhere, but I could not find it.  
I have two vectors, x,y, of different length, and I want to recycle  
the smaller one (whichever one it is) until they have the same  
length. I was wondering if there is a anything better than something  
like:

x<-1:3
y<-1:10
x<-rep(x,length=max(x,y))
y<-rep(y,length=max(x,y))

or some variant of that using if to avoid the two calls to rep.

Haris Skiadas
Department of Mathematics and Computer Science
Hanover College

______________________________________________
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