https://github.com/cran/pracma
Tip revision: 71455748623ef69836470c75c5f9384f6e872d45 authored by HwB on 28 June 2011, 00:00:00 UTC
version 0.6-3
version 0.6-3
Tip revision: 7145574
nchoosek.R
##
## n c h o o s e k . R Binomial Coefficients
##
nchoosek <- function(n, k) {
stopifnot(is.numeric(n), length(n) == 1, n >= 0, floor(n) == ceiling(n),
is.numeric(k), length(k) == 1, k >= 0, floor(k) == ceiling(k))
if (k > n)
stop("Argument 'k' must be an integer between 0 and 'n'.")
choose(n, k)
}