Re: [R] combinatorics

From: Jens Scheidtmann <JensScheidtmann_at_web.de>
Date: Sun 15 Oct 2006 - 11:54:17 GMT

Robin Hankin <r.hankin@noc.soton.ac.uk> writes:

> Hi
>
> How do I generate all ways of ordering sets of indistinguishable items?
>
> suppose I have two A's, two B's and a C.
>
> Then I want
>
> AABBC
> AABCB
> AACBC
> ABABC
> . . .snip...
> BBAAC
> . . .snip...
> CBBAA
>
> [there are 5!/(2!*2!) = 30 arrangements. Note AABBC != BBAAC]
>
> How do I do this?

See Knuth, The Art of Computer Programming Vol 4, Fascicle 3 and 4.

Jens



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 Oct 15 22:00:16 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 Sun 15 Oct 2006 - 13:30:10 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.