Learn R Programming

multicool (version 1.0.1)

allPerm: Generate and return all permutations of a multiset

Description

This function will return all permutations of a multiset

Usage

allPerm(mcObj)

Value

A matrix with each row being a different permutation of the multiset

Arguments

mcObj

an object of class mc - usually generated by initMC

Author

James M. Curran

Details

This function will return all permutations of a multiset. It makes no check to see if this is a sensible thing to do. Users are advised to check how many permutations are possible using the multinom function in this package.

See Also

initMC, multinom

Examples

Run this code

## a small numeric example with 6 permuations
x = c(1,1,2,2)
m = initMC(x)
allPerm(m)

## a large character example - 60 possibilities
x = rep(letters[1:3], 3:1)
multinom(x) ## calculate the number of permutations
m = initMC(x)
allPerm(m)

Run the code above in your browser using DataLab