Computes all possible combinations of n objects taken k at a time.

Combinations(n, k)

Arguments

n

a number

k

a number less than or equal to n

Value

Returns a matrix containing the possible combinations of n objects taken k at a time.

See also

SRS

Examples

Combinations(5,2)
#> [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] #> 1 1 2 1 2 3 1 2 3 4 #> N 2 3 3 4 4 4 5 5 5 5
# The columns in the matrix list the values of the 10 possible # combinations of 5 things taken 2 at a time.