Description Usage Arguments Value Examples
View source: R/internalHelpers.R
get all combinations with a maximum number of repetitions
1 2 | getCombinationsWithMaxNRepetitions(sourceVector, nDraws,
maxRepetitions = 1, nCombinationsOnly = FALSE)
|
sourceVector |
is a vector with options to draw from |
nDraws |
the combination size |
maxRepetitions |
the number of times an element of the |
nCombinationsOnly |
if TRUE it returns the number of combinations instead of the combinations itself, defaults to FALSE |
a matrix with as a combination per row, unless nCombinationsOnly
is TRUE
1 2 3 4 5 | test1 <- getCombinationsWithMaxNRepetitions( c("a" , "b" , "c" ) ,
nDraws = 2, maxRepetitions = 2 )
test2 <- getCombinationsWithMaxNRepetitions( 1:5 , nDraws = 3, maxRepetitions = 3 )
test3 <- getCombinationsWithMaxNRepetitions( 1:5 , nDraws = 3, maxRepetitions = 3 ,
nCombinationsOnly = TRUE )
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.