8

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?

Community
  • 1
  • 1
Debarghya
  • 81
  • 1
  • 1
  • 3
  • @BlueMagister thanks, never used the package before and did my best to decipher the question. Post it as an answer I bet it'll be a winner! – Justin Feb 01 '13 at 20:59
  • This question is marked as a duplicate of another question that was closed as off topic - and that is probably unclear and surely unrelated. It seems that somebody read the title of the question but not the question itself. This question shouldn't be marked as duplicate. – Pere Apr 07 '18 at 14:47

1 Answers1

41

Use the base function choose:

choose(10,2)
#[1] 45
Blue Magister
  • 13,044
  • 5
  • 38
  • 56