perms | R Documentation |
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
.
randperm
perms(6)
perms(1:6)
perms(c(1, exp(1), pi))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.