[R] sampling without repetition

Murray Jorgensen maj at stats.waikato.ac.nz
Tue Nov 18 09:09:30 CET 2003


Really you just want a random permutation of r:

> rperm <- sample(r)

Then you can obtain a random partition of r into cells of any desired size
simply by taking appropriately-sized consecutive blocks of rperm.

Murray

At 22:42 17/11/2003 -0500, Rajarshi Guha wrote:

>Sorry for not providing all the details.
>
>The 3 sets can be of any size (which will be specified by the user of
>the function) and cover all of r (ie, set1 + set2 + set3 == r)
>
>Thanks to everybody for all the solutions.
>
>-------------------------------------------------------------------
>Rajarshi Guha <rxg218 at psu.edu> <http://jijo.cjb.net>
>GPG Fingerprint: 0CCA 8EE2 2EEB 25E2 AB04 06F7 1BB9 E634 9B87 56EE
>-------------------------------------------------------------------
>"I'd love to go out with you, but there are important world issues that
>need worrying about."
>
>______________________________________________
>R-help at stat.math.ethz.ch mailing list
>https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> 
Dr Murray Jorgensen      http://www.stats.waikato.ac.nz/Staff/maj.html
Department of Statistics, University of Waikato, Hamilton, New Zealand
Email: maj at waikato.ac.nz                                Fax 7 838 4155
Phone  +64 7 838 4773 wk    +64 7 849 6486 home    Mobile 021 1395 862




More information about the R-help mailing list