[R] alternative to rep
Bill Shipley
Bill.Shipley at Usherbrooke.ca
Thu Nov 14 01:45:43 CET 2002
Hello. the rep(x) function replicates the vector x. I am looking for a
quick way of "expanding" a vector. Here is what I mean by "expand":
given: x<-c(2,5,4)
If I "expand" x three times, then I will get 2,2,2,5,5,5,4,4,4. In other
words, I want to keep the original ordering (2,5,4) but duplicate each of
the original entries three times.
Is there such a function? If not, can someone suggest a fast way of doing
this?
Thanks.
Bill Shipley
Departement de biologie
Universite de Sherbrooke
Sherbrooke (Quebec) CANADA J1K 2R9
Bill.Shipley at USherbrooke.ca
http://callisto.si.usherb.ca:8080/bshipley/
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
More information about the R-help
mailing list