[R] Dividing objects in classes using function sample()
"Maja Schröter"
maja.schroeter at gmx.de
Sat Sep 2 16:53:30 CEST 2006
Hello everyone,
I've a problem and dont know how to solve. This is my first posting and it would be fantastic if you could help me.
I want to divide n objects in k classes and need an output with all (n+1)(n+2)/2 possibilities.
For example n=4, k=3:
That would be:
4 0 0
3 1 0
3 0 1
2 2 0
2 1 1
2 0 2
1 3 0
1 2 1
1 1 2
1 0 3
0 3 1
0 2 2
0 1 3
0 0 4
I tried to you use permn() or sample() but I don't know how to solve.
Please help me!
Best regards,
Maja
--
"Feel free" – 10 GB Mailbox, 100 FreeSMS/Monat ...
More information about the R-help
mailing list