Description Usage Arguments See Also Examples
Number of permutations
1 2 |
x |
an integer or a vector, will be treated as |
k |
an integer, the number of items drawn, defaults to |
n |
an integer, the total number of items, its value may be implicitly deduced from |
v |
a vector to be drawn, defaults to |
freq |
an integer vector of item repeat frequencies |
replace |
an logical to draw items with replacement |
bigz |
an logical to use gmp::bigz |
permutations for generating all permutations and ipermutations for iterating permutations
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | npermutations(7)
npermutations(LETTERS[1:5])
npermutations(5, 2)
npermutations(LETTERS, k = 5)
# integer overflow
## Not run: npermutations(14, 10)
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(k = 2, freq = c(1, 2))
# zero sized partitions
npermutations(0)
npermutations(5, 0)
npermutations(5, 6)
npermutations(0, 1)
npermutations(0, 0)
|
[1] 5040
[1] 120
[1] 20
[1] 7893600
Big Integer ('bigz') :
[1] 3632428800
[1] 3
[1] 1
[1] 1
[1] 0
[1] 0
[1] 1
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.