powered by
Build an expanded formula with poly and interaction terms
build_formula(formula, poly_terms = NULL, interaction_terms = NULL)
A formula object combining all terms
A base formula in the format Y ~ X | Z1 + Z2
Character vector of polynomial term names
Character vector of interaction term names
poly_terms <- c("Z1_d_2", "Z2_d_2") interaction_terms <- c("Z1_int_Z2") formula <- Y ~ X | Z1 + Z2 final_formula <- build_formula(formula, poly_terms, interaction_terms) print(final_formula)
Run the code above in your browser using DataLab