[R] combinations without repetition

davidr@rhotrading.com davidr at rhotrading.com
Mon Feb 14 15:59:58 CET 2005


These would more properly be called permutations of a multiset.
You can find code on the net by searching for "generate permutations
multiset" (though not in R AFAICS.)

David L. Reiner

-----Original Message-----
From: mjenny at rumms.uni-mannheim.de [mailto:mjenny at rumms.uni-mannheim.de]

Sent: Sunday, February 13, 2005 8:45 AM
To: r-help at stat.math.ethz.ch
Subject: [R] combinations without repetition

The solution is probably simple but I need someone to point me to it.
How can I reduce the following 6 permutations to the 3 unique
combinations
(1,1,0) (1,0,1) (0,1,1)?

permn(c(1,1,0))
[[1]]
[1] 1 1 0

[[2]]
[1] 1 0 1

[[3]]
[1] 0 1 1

[[4]]
[1] 0 1 1

[[5]]
[1] 1 0 1

[[6]]
[1] 1 1 0

Thanks a lot
Marcelo Jenny

______________________________________________
R-help at 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




More information about the R-help mailing list