Description Usage Arguments Value Author(s) See Also Examples
This function generates all permutations of n elements taken k at a time. The most efficient way to generate n! permutations of vec in a Lexicographic order without recursive algorithm in R.
1 | generate.perms(n, k = n, vec = 1:n)
|
n |
number of the whole elements |
k |
number of elements to permute (default the same as n) |
vec |
the source vector of length n (default as c(1:n)) |
a matrix or a vector, each row is a permutation
Li Qinglong <liqinglong0830@163.com>
generate.combn
1 | generate.perms(10, 6)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.