allPerm: Generate and return all permutations of a multiset

Description Usage Arguments Details Value Note Author(s) See Also Examples

Description

This function will return all permutations of a multiset

Usage

1
allPerm(mcObj)

Arguments

mcObj

an object of class mc - usually generated by initMC

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.

Value

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

Note

This function does not warn the user that the requested set of permutations may be very large. In addition, all working is handled entirely in memory, and so this may cause it to crash if the request is execeptionally large.

Author(s)

James M. Curran

See Also

initMC, multinom

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
## 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)


Search within the multicool package
Search all R packages, documentation and source code

Questions? Problems? Suggestions? or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.