if n is total element (here 9) and k is the subset element (here 7) the we can say it is \(\left( \begin{array}{cccc} n \\ k\end{array}\right)\) (n choose k)
There is n way we can choose the first element and n-1 ways we can choose the second and n-2 ways we can choose the third element so on..
There are n (n-1) (n-2) .. (n - (k - 1)) ways to choose k
\[\frac{n!}{k!(n-k)!}\]
Let substitute:
n <- 9
k <- 7
factorial(n)/(factorial(k)*factorial(n-k))
## [1] 36
Another method:
choose(9,7)
## [1] 36