nextPerm: Return the next permutation of the multiset

Description Usage Arguments Value Author(s) See Also Examples

View source: R/nextPerm.R

Description

This function returns the next permuation of the multiset if there is one. initMC called before nextPerm can be called.

Usage

1
nextPerm(mcObj)

Arguments

mcObj

an S3 object of class mc which must be created with initMC

Value

either a vector with the next permutation of the multiset or FALSE when all permutations have been returned

Author(s)

James M. Curran

See Also

nextPerm

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
x = c(1,1,2,2)
m1 = initMC(x)

for(i in 1:6){
  cat(paste(paste(nextPerm(m1),collapse=","),"\n"))
}

## an example with letters
x = letters[1:4]
m2 = initMC(x)
nextPerm(m2)
nextPerm(m2)
## and so on

multicool documentation built on June 29, 2021, 9:08 a.m.