Inserts * between variables in a term where it may have been omitted.

format_qca_term(term, var_names, use_tilde = TRUE)

Arguments

term

Character. A single term (e.g., "KSPRVT" or "~KPR*PRD").

var_names

Character vector. Variable names used in the analysis.

use_tilde

Logical. If TRUE, negation is represented as ~VAR. If FALSE, negation is represented as lowercase (e.g., var).

Value

Character. The formatted term with * between all variables.

Examples

var_names <- c("KSP", "KPR", "PRD", "RVT", "RCM")
format_qca_term("KSPRVTRCM", var_names)
#> [1] "KSP*RVT*RCM"
# Returns: "KSP*RVT*RCM"

format_qca_term("~KPRPRD", var_names)
#> [1] "~KPR*PRD"
# Returns: "~KPR*PRD"