R/helper_clean_formula.R

Defines functions clean_formula

# Convert formula to text and clean using regex
clean_formula <- function(formula) {
  formula_text <- deparse(formula)
  cleaned <- gsub("\\w+\\$", "", formula_text)  # Remove text before $
  output <- as.formula(paste(cleaned, collapse = ""))
  return(output)
}

Try the rfriend package in your browser

Any scripts or data that you put into this service are public.

rfriend documentation built on Aug. 8, 2025, 7:33 p.m.