[R] sampling without repetition

Rajarshi Guha rxg218 at psu.edu
Tue Nov 18 04:42:25 CET 2003

On Mon, 2003-11-17 at 20:31, Duncan Murdoch wrote:
> On 17 Nov 2003 20:07:08 -0500, you wrote:
> >Sorry about that. I wanted to select 3 disjoint sets from a supplied
> >vector of numbers. My initial example had 
> >
> >r <- 1:300
> >
> >but there is no guarantee that r will contain a consecutive sequence of
> >numbers.
> It's still not clear whether the 3 sets should be of fixed size or
> random size, and whether they should cover all of r or just part of
> it.  Thomas' solution gave you a random partition.  If you just want 3
> non-overlapping samples, each of size n, then do something like:

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."

More information about the R-help mailing list