generate.perms: Generate all possible permutations of k elements out of n
Description
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.
Usage
generate.perms(n, k = n, vec = 1:n)
Arguments
n
number of the whole elements
k
number of elements to permute (default the same as n)