[EMAIL PROTECTED] wrote:

> I'me trying to write  a function that will shuffle a vector.
> At the moment I'm baically making a vector of randomized indices
> and then making  a new vector from the original one using these
> random indices.

What's your definition of "elegant"?  :-)

Isn't this elegant enough?

   x[order(runif(length(x)))]

Peter

-- 
Peter J. Acklam - [EMAIL PROTECTED] - http://home.online.no/~pjacklam

______________________________________________
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help

Reply via email to