as_model_matrix {bigutilsr}R Documentation

Transform a data frame

Description

Transform a data frame into a matrix using one hot encoding.

Usage

as_model_matrix(df, intercept = FALSE)

Arguments

df

A data frame.

intercept

Whether to have a column with all 1s. Default is FALSE.

Value

A matrix.

Examples

mat <- as_model_matrix(iris)
str(mat)

[Package bigutilsr version 0.3.4 Index]