https://github.com/cran/pracma
Tip revision: c79a04b5074656b36e591191eb8137b70a349932 authored by Hans W. Borchers on 30 June 2014, 00:00:00 UTC
version 1.7.0
version 1.7.0
Tip revision: c79a04b
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)
}