perms: Generate Permutations

Description Usage Arguments Details Value Note See Also Examples

Description

Generates all permutations of a vector a.

Usage

1
perms(a)

Arguments

a

numeric vector of some length n

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

randperm

Examples

1
2
3
perms(6)
perms(1:6)
perms(c(1, exp(1), pi))


Search within the pracma package
Search all R packages, documentation and source code

Questions? Problems? Suggestions? or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.