R/dropFormula.R

Defines functions dropFormula

Documented in dropFormula

dropFormula <- function(original, drop) {
    factors <- attr(terms(as.formula(original)),
                    "factors")
    row <-  match(drop, rownames(factors))
    whichTerms <- factors[row,] == 1
    labels <- colnames(factors)[whichTerms]
    text <- paste("~ . ",
                  paste("-", labels, collapse = " "))
    eval(parse(text = text))
}

Try the SoDA package in your browser

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

SoDA documentation built on Oct. 28, 2020, 9:07 a.m.