lm
, etc.
terms(formula, specials, abb = NULL, data, neg.out = T, keep.order = F) as.terms(object)
abbreviate
function; that is, a character vector containing the abbreviations
that has a names attribute specifying the full names to be used.
If abbreviations are used, all the expanded names will appear everywhere
in the terms object.
"."
to
refer to all the variables in the data frame.
"-"
sign.
If
TRUE
, terms will be checked for cancellation and otherwise
ignored.
If
FALSE
, negative terms will be retained (with negative order).
The latter version is used, for example, in
fractionate
.
"terms"
describing the formula.
See
terms.object
for its detailed contents.
This object drives all the model-fitting and is returned as a component
of the fitted object by the fitting functions
lm
, etc.
The object itself is of mode
"expression"
, with one element for each of
the terms, after expansion and possible simplification, and not including
the intercept.
as.terms
leaves term objects alone, and converts formula
objects, and a variety of objects that contain formulas as components or
attributes, by calling
terms
.
Returns a
terms.object
that describes the information about a structural
model, as specified by a formula.
terms(Yield~Temp*Conc+Error(blocks),specials="Error") # Produces the following output: expression(Temp, Conc, Error(blocks), Temp:Conc) attr(, "formula"): Yield ~ Temp * Conc + Error(blocks) attr(, "factors"): Temp Conc Error(blocks) Temp:Conc Yield 0 0 0 0 Temp 1 0 0 1 Conc 0 1 0 1 Error(blocks) 0 0 1 0 attr(, "order"): [1] 1 1 1 2 attr(, "variables"): expression(Yield, Temp, Conc, Error(blocks)) attr(, "term.labels"): [1] "Temp" "Conc" "Error(blocks)" "Temp:Conc" attr(, "intercept"): [1] 1 attr(, "response"): [1] 1 attr(, "specials"): attr(, "specials")$Error: [1] 4 attr(, "class"): [1] "terms" # an example of keep.order = T aov.with.means <- aov(terms(Weight~Trans1:Trans2+Tires-1, keep.order = T), cu.specs)