[R] all combinations with replacement

Kehl Dániel kehld at ktk.pte.hu
Thu Apr 21 21:28:41 CEST 2011


Dear all,

is there an easy way to get all possible combinations (?) with replacement.
If n=6, k=3, i want something like

0 0 6
0 5 1
0 4 2
0 3 3
0 2 4
.
.
.
5 0 1
5 1 0
6 0 0

I tried to look at combn() but I could not get this done with it.

Thank you in advance:
Daniel



More information about the R-help mailing list