modelr (version 0.1.1)

model_matrix: Construct a design matrix

Description

This is a thin wrapper around model.matrix() which returns a tibble. Use it to determine how your modelling formula is translated into a matrix, an thence into an equation.

Usage

model_matrix(data, formula, ...)

Arguments

data

A data frame

formula

A modelling formula

...

Other arguments passed onto model.matrix()

Value

A tibble.

Examples

Run this code
# NOT RUN {
model_matrix(mtcars, mpg ~ cyl)
model_matrix(iris, Sepal.Length ~ Species)
model_matrix(iris, Sepal.Length ~ Species - 1)
# }

Run the code above in your browser using DataCamp Workspace