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

Johannes Hüsing johannes at huesing.name
Sun Sep 3 07:03:24 CEST 2006

> 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').

More information about the R-help mailing list