permutations: Determine all permutations of a set.

Description Usage Arguments Value Examples

View source: R/permutations.R

Description

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

Usage

1

Arguments

set

a set

Value

a matrix whose rows are the permutations of set

Examples

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

mpoly documentation built on March 26, 2020, 7:33 p.m.