powered by
Recursively generates all permutations of a vector. The result will be factorial(length(vals)) long so be careful with any longer vectors (e.g. longer than 10).
factorial(length(vals))
permute(vals)
A list of vectors containing all permutation of the values
a vector of elements to be permuted
sample
permute(letters[1:3]) permute(1:5)
Run the code above in your browser using DataLab