https://github.com/cran/pracma
Tip revision: 708a2ad382a163d1eef5af0665e3ae2aad200ced authored by HwB on 21 March 2013, 00:00:00 UTC
version 1.4.5
version 1.4.5
Tip revision: 708a2ad
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)
}