factorial
Factorial, Combinations, and Permutations

Description

Computes the factorial (n!), the binomial coefficients, and the number of combinations.

Usage

factorial(x) 
lfactorial(x) 
choose(n, k)
lchoose(n, k)

Arguments

x, n an integer vector. Need not to be an integer for factorial or lfactorial.
k an integer vector.
m an integer vector that sums to n.

Details

These functions use gamma and lgamma for computations.
Value
returns a numeric vector. Specifically:
factorial(x) returns x!.
lfactorial(x) returns the natural logarithm of x!.
choose(n, k) returns n! / (k! (n-k)!); the number of ways of selecting k items from n when order does not matter.
lchoose(n, k) returns the natural logarithm of n! / (k! (n-k)!).
See Also
gamma, lgamma
Examples
factorial(5:7) 
lfactorial(5.5)
choose(5, 2) 
lchoose(5.2, 2)
choose(5, -1:6) 
Package base version 6.1.4-13
Package Index