Learn R Programming

arrangements (version 1.0.0)

ncombinations: Number of combinations

Description

Number of combinations

Usage

ncombinations(n, k, x = NULL, freq = NULL, replace = FALSE,
  bigz = FALSE)

Arguments

n

an integer, would be determined implicitly from x or f if missing

k

an integer

x

an optional vector indicating item labels

freq

an integer vector of item repeat frequencies

replace

an logical to draw items with replacement

bigz

an logical to indicate using gmp::bigz

See Also

combinations for generating all combinations and icombinations for iterating combinations

Examples

Run this code
# NOT RUN {
ncombinations(5, 2)
ncombinations(x = LETTERS, k = 5)

# integer overflow
# }
# NOT RUN {
ncombinations(40, 15)
# }
# NOT RUN {
ncombinations(40, 15, bigz = TRUE)

# number of combinations of `c("a", "b", "b")`
# they are `c("a", "b")` and `c("b", "b")`
ncombinations(freq = c(1, 2), k = 2)

# zero sized combinations
ncombinations(5, 0)
ncombinations(5, 6)
ncombinations(0, 1)
ncombinations(0, 0)

# }

Run the code above in your browser using DataLab