Vector Permutations

Share:

Description

Enumerates all permutations of a vector

Usage

1
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

1
2
perm(1:4)
perm(LETTERS[4:8])

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.