The fac_and_contr
function is a convenience function which coerces
x
to a factor with specified levels
and contrasts
.
fac_and_contr(x, levels, contrasts, ordered = FALSE)
An object coercible to factor
.
A character vector of levels for the factor.
A matrix of contrasts
for the factor.
A logical indicating whether or not the factor is ordered
(default FALSE
).
named_contr_sum
(unordered factors) and
scaled_contr_poly
(ordered factors).