Use choose() to calculate the number of combinations (binomial coefficients)
choose(3,2)
#[1] 3
choose(3,1)
#[1] 3
choose(3,3)
#[1] 1
For k ≥ 1 it is defined as n(n-1)…(n-k+1) / k!, as 1 for k = 0 and as 0 for negative k.
See also:
https://www.r-bloggers.com/learning-r-permutations-and-combinations-with-base-r