perms: Generate Permutations

View source: R/perms.R

permsR Documentation

Generate Permutations

Description

Generates all permutations of a vector a.

Usage

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

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

pracma documentation built on Nov. 10, 2023, 1:14 a.m.