Learn R Programming

CCI (version 0.3.6)

build_formula: Build an expanded formula with poly and interaction terms

Description

Build an expanded formula with poly and interaction terms

Usage

build_formula(formula, poly_terms = NULL, interaction_terms = NULL)

Value

A formula object combining all terms

Arguments

formula

A base formula in the format Y ~ X | Z1 + Z2

poly_terms

Character vector of polynomial term names

interaction_terms

Character vector of interaction term names

Examples

Run this code
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