Learn R Programming

Deducer (version 0.7-9)

perm: Vector Permutations

Description

Enumerates all permutations of a vector

Usage

perm(vec,duplicates=FALSE)

Arguments

vec
The vector to permute
duplicates
Should duplicate permutations be listed

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.

See Also

sample

Examples

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

Run the code above in your browser using DataLab