Learn R Programming

arrangements (version 1.0.0)

npermutations: Number of permutations

Description

Number of permutations

Usage

npermutations(n, k = n, 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

permutations for generating all permutations and ipermutations for iterating permutations

Examples

Run this code
# NOT RUN {
npermutations(7)
npermutations(x = LETTERS[1:5])
npermutations(5, 2)
npermutations(x = LETTERS, k = 5)

# integer overflow
# }
# NOT RUN {
npermutations(14, 10)
# }
# NOT RUN {
npermutations(14, 10, bigz = TRUE)

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

# zero sized partitions
npermutations(0)
npermutations(5, 0)
npermutations(5, 6)
npermutations(0, 1)
npermutations(0, 0)
# }

Run the code above in your browser using DataLab