Description Usage Arguments Details Value Examples
A flexible implementation of the classical formula based interface.
1 2 3 4 5 |
formula |
a symbolic description of the model to be fit. |
data |
an optional data frame containing the variables in the model.
If not found in |
subset |
an optional vector specifying a subset of observations to be used in the fitting process. |
na.action |
a function which indicates what should happen when the data
contain |
frame |
an optional environment |
enclos |
specifies the enclosure passed to |
other |
an optional named list of additional formulae. |
designMatrix |
a logical indicating whether the design matrix
defined by the right hand side of |
responseMatrix |
a logical indicating whether the design matrix
defined by the left hand side of |
setHook |
a list of functions to |
... |
additional arguments for be passed to function, for example
|
This function is an attempt to provide a flexible infrastucture for the
implementation of classical formula based interfaces. The arguments
formula
, data
, subset
and na.action
are well
known and are defined in the same way as in lm
, for example.
ModelEnvFormula
returns an object of class
ModelEnvFormula-class
- a high level object for storing
data improving upon the capabilities of data.frame
s.
An object of class ModelEnvFormula-class
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | ### the `usual' interface
data(iris)
mf <- ModelEnvFormula(Species ~ ., data = iris)
mf
### extract data from the ModelEnv object
summary(mf@get("response"))
summary(mf@get("input"))
dim(mf@get("designMatrix"))
### contrasts
mf <- ModelEnvFormula(Petal.Width ~ Species, data = iris,
contrasts.arg = list(Species = contr.treatment))
attr(mf@get("designMatrix"), "contrasts")
mf <- ModelEnvFormula(Petal.Width ~ Species, data = iris,
contrasts.arg = list(Species = contr.sum))
attr(mf@get("designMatrix"), "contrasts")
### additional formulae
mf <- ModelEnvFormula(Petal.Width ~ Species, data = iris,
other = list(pl = ~ Petal.Length))
ls(mf@env)
identical(mf@get("pl")[[1]], iris[["Petal.Length"]])
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.