getCombinationsWithMaxNRepetitions: get all combinations with a maximum number of repetitions

Description Usage Arguments Value Examples

View source: R/internalHelpers.R

Description

get all combinations with a maximum number of repetitions

Usage

1
2
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

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  )

microsamplingDesign documentation built on Oct. 13, 2021, 5:10 p.m.