model_matrix: Preserves all factor levels when creating a model matrix

Description Usage Arguments Value Examples

View source: R/model_matrix.R

Description

In some cases it's easier to not have a reference level for dummy variables. This function will preserve all levels of character and factor variables when using model.matrix.

Usage

1
model_matrix(object, .data)

Arguments

object

the formula for creating the model

.data

a data frame

Value

a numeric matrix to be used for modeling purposes

Examples

1
head(model_matrix(iris, Petal.Width ~ Petal.Length + Species))

mattmills49/modeler documentation built on May 21, 2019, 1:25 p.m.