Re: [R] Dividing objects in classes using function sample()

From: Johannes Hüsing <johannes_at_huesing.name>
Date: Sun 03 Sep 2006 - 11:07:08 GMT


> I want to divide n objects in k classes and need an output with all
> (n+1)(n+2)/2 possibilities.

That's the "set of compositions". You may use the partitions package and proceed from there (provided the brute-force method suggested by Gabor is not viable').



R-help@stat.math.ethz.ch 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. Received on Sun Sep 03 21:11:05 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Thu 07 Sep 2006 - 07:51:17 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.