Learn R Programming

microsamplingDesign (version 1.0.8)

getCombinationsWithMaxNRepetitions: get all combinations with a maximum number of repetitions

Description

get all combinations with a maximum number of repetitions

Usage

getCombinationsWithMaxNRepetitions(sourceVector, nDraws,
  maxRepetitions = 1, nCombinationsOnly = FALSE)

Arguments

sourceVector

is a vector with options to draw from

nDraws

the combination size

maxRepetitions

the number of times an element of the sampleVector can occur in a group

nCombinationsOnly

if TRUE it returns the number of combinations instead of the combinations itself, defaults to FALSE

Value

a matrix with as a combination per row, unless nCombinationsOnly is TRUE

Examples

Run this code
# NOT RUN {
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  )
# }

Run the code above in your browser using DataLab