Generate Permutations
Generates all permutations of a vector a
.
perms(a)
a |
numeric vector of some length |
If a
is a vector of length n
, generate all permutations
of the elements in a
as a matrix of size n! x n
where
each row represents one permutation.
A matrix will be expanded as vector.
matrix of permutations of the elements of a
Not feasible for length(a) > 10
.
perms(6) perms(1:6) perms(c(1, exp(1), pi))
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.