Skip to content

exclude a vector value from another vector

4 messages · Hamid Hamid, Jorge Ivan Velez, Greg Snow +1 more

#
Others have shown ways to remove your sample from the population, but this may be doing things the long way.  If you just want several samples from the same population without overlap between any of the samples, just take one sample of size equal to the sum of the individual sample sizes, randomize the order, then split it into the individual samples.

For example, to get 6 samples of size 4 from the population of "LETTERS":
[,1] [,2] [,3] [,4] [,5] [,6]
[1,] "F"  "L"  "H"  "A"  "S"  "P"
[2,] "M"  "D"  "U"  "N"  "G"  "C"
[3,] "O"  "R"  "E"  "V"  "K"  "W"
[4,] "J"  "X"  "B"  "T"  "Z"  "I"
Now each column is a sample, us apply or a for loop to work on each one.

Hope this helps,

--
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.snow at imail.org
801.408.8111