Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

covar_from_df

Numeric matrix from data frame


Description

Transform a data frame to a numeric matrix by one-hot encoding factors. The last factor value is always omitted to prevent having a singular matrix when adding a column of 1s (intercept) in models.

Usage

covar_from_df(df)

Arguments

df

A data frame.

Value

A numeric matrix.

Examples

mat <- covar_from_df(iris)
head(mat)

bigstatsr

Statistical Tools for Filebacked Big Matrices

v1.5.1
GPL-3
Authors
Florian Privé [aut, cre], Michael Blum [ths], Hugues Aschard [ths]
Initial release
2021-04-05

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.