On Dec 2, 2011, at 10:09 AM, statfan wrote:

say n = 100
I want to partition this into 4 random groups wheren n1 + n2 + n3 + n4 = n
and ni is the number of elements in group i.


Try assigning with a sample() from:

unlist(mapply(rep, c(1:4), each=c(n1,n2,n3,n4)))

--

David Winsemius, MD
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