Generates a mixture formula from a vector of variable names and an optional vector of probabilities.

genMixFormula(vars, probs = NULL, varLength = NULL)

## Arguments

vars Character vector/list of variable names. Numeric vector/list of probabilities. Has to be same length as vars or NULL. Probabilities will be normalized if the sum to > 1. If vars is of length one and varLength is set to any integer > 0, vars will be interpreted as array of length varLength and all elements will used in sequence.

## Value

The mixture formula as a string.

## Examples

genMixFormula(c("a", "..b[..i]", "c"))
#> [1] "a | 0.333333333333333 + ..b[..i] | 0.333333333333333 + c | 0.333333333333333"genMixFormula(c("a", "..b", "c"), c(.2, .5, .3))
#> [1] "a | 0.2 + ..b | 0.5 + c | 0.3"
# Shorthand to use external vectors/lists
genMixFormula("..arr", varLength = 5)
#> [1] "..arr[[1]] | 0.2 + ..arr[[2]] | 0.2 + ..arr[[3]] | 0.2 + ..arr[[4]] | 0.2 + ..arr[[5]] | 0.2"