nextPerm | R Documentation |
This function returns the next permuation of the multiset if there is one.
initMC
called before nextPerm
can be called.
nextPerm(mcObj)
mcObj |
an S3 object of class |
either a vector with the next permutation of the multiset or
FALSE
when all permutations have been returned
James M. Curran
nextPerm
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
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.