On Oct 15, 2009, at 10:19 AM, Marcio Resende wrote:


I would like to divide a vector in 9 groups in a way that each number is
present in only one group.
In a vector of 783 I would like to divide in 9 different groups of 87

Example <- matrix(c(1:783),ncol = 1)


> Example <- matrix(c(1:783),ncol = 1)
> Grp1 <- sample(Example, 87, replace=FALSE)
> Grp2 <- sample(Example[-Grp1], 87, replace=FALSE)
> Grp3 <- sample(Example[-c(Grp1, Grp2)], 87, replace=FALSE)
# lather, rinse , repeat


s1 <- as.matrix(sample(Example,87, re = FALSE))
Example <- Example[-s1]
s2 <- as.matrix(sample(Example,87, re = FALSE))
#however I donĀ“t know how to remove the second group from the "Example" to
continue sampling.


#Don't mess up the original

There is probably an easy and faster way to do this.
Could anybody help me?
Thanks
--

David Winsemius, MD
Heritage Laboratories
West Hartford, CT

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to