Learn R Programming

Deducer (version 0.9-1)

perm: Vector Permutations

Description

Enumerates all permutations of a vector

Usage

perm(vec,duplicates=FALSE)

Value

Returns a matrix where each row is a permutation of vec. All possible permutations are listed, and if duplicates=TRUE non-unique permutations are also listed.

Arguments

vec

The vector to permute

duplicates

Should duplicate permutations be listed

See Also

Examples

Run this code
perm(1:4)
perm(LETTERS[4:8])

Run the code above in your browser using DataLab