The model matrix of a formula on a data frame, with the attributes of R's terms(). Equivalent to R's
model.matrix(formula, data). With contrasts.arg, together with attr(terms(formula), ...).
Rows with a missing value (null, or NaN in a numeric column) in any variable of the formula are dropped first.
Strings are factors of the values in the rows kept (sorted by code point), unless levels gives the levels, which
are then all kept even without a row (their columns are 0); booleans are factors with always the two levels FALSE
and TRUE; numbers are numeric. The response may be of any type: it only drops its rows with a missing value.
Parameters
formula: string
A formula such as "y ~ A * B", "y ~ x + A - 1" or "~ A".
The model matrix of a formula on a data frame, with the attributes of R's
terms(). Equivalent to R'smodel.matrix(formula, data). Withcontrasts.arg, together withattr(terms(formula), ...).Rows with a missing value (
null, orNaNin a numeric column) in any variable of the formula are dropped first. Strings are factors of the values in the rows kept (sorted by code point), unlesslevelsgives the levels, which are then all kept even without a row (their columns are 0); booleans are factors with always the two levels FALSE and TRUE; numbers are numeric. The response may be of any type: it only drops its rows with a missing value.