genMixFormula {simstudy} | R Documentation |
Generate Mixture Formula
Description
Generates a mixture formula from a vector of variable names and an optional vector of probabilities.
Usage
genMixFormula(vars, probs = NULL, varLength = NULL)
Arguments
vars |
Character vector/list of variable names. |
probs |
Numeric vector/list of probabilities. Has to be same length as vars or NULL. Probabilities will be normalized if the sum to > 1. |
varLength |
If |
Value
The mixture formula as a string.
Examples
genMixFormula(c("a", "..b[..i]", "c"))
genMixFormula(c("a", "..b", "c"), c(.2, .5, .3))
# Shorthand to use external vectors/lists
genMixFormula("..arr", varLength = 5)
[Package simstudy version 0.8.1 Index]