modelMatrix: Create design matrix from data frame

Description Usage Arguments

Description

modelMatrix takes in a data.frame and encodes it as a model.matrix object. Factors use treatment ("one-hot") encoding, creating indicator variables from categorical and binary variables. Note that names of categorical variables will change slightly (n-1 unique values appended to name)

Usage

1
modelMatrix(x, interactions = FALSE, sparse = TRUE, intercept = FALSE)

Arguments

x

A data.frame with finite, non-missing elements.

interactions

Logical; if TRUE then all interactions included.

sparse

Logical; if TRUE then output a sparse Matrix object.

intercept

Logcal; if TRUE then include a leading column of 1's.


dhelkey/dgrank documentation built on May 12, 2019, 5:24 p.m.