| terms.formula {stats} | R Documentation |
Construct a terms Object from a Formula
Description
This function takes a formula and some optional arguments and
constructs a terms object, which
can then be used to construct a model.matrix.
Usage
## S3 method for class 'formula'
terms(x, specials = NULL, abb = NULL, data = NULL, neg.out = TRUE,
keep.order = FALSE, simplify = FALSE, ...,
allowDotAsName = FALSE)
Arguments
x |
a |
specials |
an optional character vector listing names of
functions. Calls to these functions in the formula are marked as
special in the |
abb |
Not implemented in R; deprecated. |
data |
a data frame from which the meaning of the special symbol
|
neg.out |
Not implemented in R; deprecated. |
keep.order |
a logical value indicating whether the terms should
keep their positions. By default, when |
simplify |
should the formula be expanded and simplified, the pre-1.7.0 behaviour? |
... |
further arguments passed to or from other methods. |
allowDotAsName |
normally |
Details
Non-syntactic specials are supported since R 4.6.0.
specials="pkg::name" marks as special calls
`pkg::name`(...) (note backticks) and not
calls pkg::name(...). The reverse was true prior
to R 4.6.0, but that was undocumented and accidental.
Value
A terms object is returned. It is the re-ordered formula (unless
keep.order = TRUE) with several attributes, see
terms.object for details. In all
cases variables within an interaction term in the formula are
re-ordered by the ordering of the "variables" attribute, which
is the order in which the variables occur in the formula.
See Also
terms, terms.object, also for examples.