perms: Generate Permutations

Description Usage Arguments Details Value Note See Also Examples

View source: R/perms.R

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))

pracma documentation built on Nov. 22, 2017, 1:08 a.m.