terms.formula {stats}R Documentation

Construct a terms Object from a Formula


This function takes a formula and some optional arguments and constructs a terms object. The terms object can then be used to construct a model.matrix.


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



a formula.


which functions in the formula should be marked as special in the terms object? A character vector or NULL.


Not implemented in R; deprecated.


a data frame from which the meaning of the special symbol . can be inferred. It is used only if there is a . in the formula.


Not implemented in R; deprecated.


a logical value indicating whether the terms should keep their positions. By default, when FALSE, the terms are reordered so that main effects come first, followed by the interactions, all second-order, all third-order and so on. Effects of a given order are kept in the order specified.


should the formula be expanded and simplified, the pre-1.7.0 behaviour?


further arguments passed to or from other methods.


normally . in a formula refers to the remaining variables contained in data. Exceptionally, . can be treated as a name for non-standard uses of formulae.


Not all of the options work in the same way that they do in S and not all are implemented.


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.

[Package stats version 4.3.0 Index]