Possible Duplicate:
How to calculate combination and permutation in R?
When I try to calculate combinations in R using the Combinat
package and the combn
command it gives me all possible combinations. But I just want to return the number of combinations, i.e. I want to get 45 in case of 10C2. What should I do?
If we choose a set of r items from n types of items, where repetition is allowed and the number items we are choosing from is essentially unlimited, the number of selections possible: (n+r−1r).
Answer and Explanation: The number of possible combinations with 4 numbers without repetition is 15.
How many combinations with 5 numbers without repetition are possible? There's one (1) possible combination without repetitions C(n,r) and 126 combinations with repetitions C'(n,r) of arranging a group of five numbers (i.e., the 1-5 number list).
Use the base function choose
:
choose(10,2)
#[1] 45
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With