terms
Create or Extract a Terms Object

Description

Creates a terms object that you can use when you are fitting a model. terms is generic, the principal method parses a formula object and the other methods extract the terms object that various modeling functions include in their outputs.

Usage

terms(x, ...)
## S3 method for class 'formula':
terms(x, specials = NULL, abb = NULL, data = NULL, 
    neg.out = TRUE, keep.order = FALSE, simplify = FALSE, ..., 
    allowDotAsName = FALSE) 
## Default S3 method:
terms(x, ...)
## S3 method for class 'terms':
terms(x, ...) 
## S3 method for class 'lm':
terms(x, ...)
## S3 method for class 'aovlist':
terms(x, ...)

Arguments

x a formula or an object that contains a terms object.
specials a character string that specifies which functions in the formula to mark as special in the terms object.
abb argument is ignored.
data data frame in which to interpret the formula. This is an optional argument that you can specify if you want to use the special name "." in the formula to refer to all the variables (except a possible response variable) in the data frame.
neg.out argument is ignored.
keep.order a logical value. If TRUE, the function preserves the order of the terms to be the same order in which the terms were generated or as they were originally found in the input. If FALSE (the default), terms are sorted so that main effects appear before interactions, and so on.
simplify a logical value. If FALSE (the default), the output formula is the same as the input formula. If TRUE, the output formula is the same as the input formula except that it is expanded to the equivalent sum of colon-separated variables whose order is controlled by the keep.order argument. In this case, the expressions in the formula that include the operators: *, ^, /, and %in% are expanded and any redundant or cancelling terms are eliminated.
allowDotAsName a logical value. If FALSE (the default) a "." on the right side (predictor) of the formula is treated as all the names of the variables in the data argument except those found on the left side (response) of the formula. If TRUE "." has no special meaning and refers to a variable named ".".
... additional arguments passed to or from other methods. Current methods for terms do not use any of these additional arguments.
Value
returns an object of class c("terms", "formula") that contains the formula along with attributes that describe the formula. For a detailed description of the contents, see terms.object. This object underlies all the model fitting and is returned as a component of the fitted object by the fitting functions lm, and so on.
Differences between Spotfire Enterprise Runtime for R and Open-source R
abb, neg.out and as.terms are not implemented in open-source R. The object attribute - formula is removed in open-source R.
See Also
formula, model.frame, model.matrix, lm, aov, terms.object.
Examples
terms(Yield ~ Temp * Conc + Error(blocks), specials="Error")
terms(Yield ~ offset(0.5*Temp) * offset(0.01*Conc) + Error(blocks), specials="Error")

Data <- data.frame(X1=sqrt(1:10), X2=log(1:10), X3=sin(1:10), X4=cos(1:10)) terms(aov(X1~X2+offset(0.1*X3)*X4, Data))

Package stats version 6.1.1-7
Package Index