permutations: Determine all permutations of a set.

View source: R/permutations.R

permutationsR Documentation

Determine all permutations of a set.

Description

An implementation of the Steinhaus-Johnson-Trotter permutation algorithm.

Usage

permutations(set)

Arguments

set

a set

Value

a matrix whose rows are the permutations of set

Examples

permutations(1:3)
permutations(c('first','second','third'))
permutations(c(1,1,3))
apply(permutations(letters[1:6]), 1, paste, collapse = '')

dkahle/mpoly documentation built on July 27, 2023, 11:44 p.m.