perms {pracma} | R Documentation |
Generate Permutations
Description
Generates all permutations of a vector a
.
Usage
perms(a)
Arguments
a |
numeric vector of some length |
Details
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.
Value
matrix of permutations of the elements of a
Note
Not feasible for length(a) > 10
.
See Also
Examples
perms(6)
perms(1:6)
perms(c(1, exp(1), pi))
[Package pracma version 2.4.4 Index]