set_as_numeric_matrix: Numeric matrix preparation for Machine Learning.

View source: R/shape_set.R

set_as_numeric_matrixR Documentation

Numeric matrix preparation for Machine Learning.

Description

Prepare a numeric matrix from a data.table. This matrix is suitable for machine learning purposes, since factors are binary. It may be sparse, include an intercept, and drop a reference column for each factor if required (when using lm(), for instance)

Usage

set_as_numeric_matrix(
  data_set,
  intercept = FALSE,
  all_cols = FALSE,
  sparse = FALSE
)

Arguments

data_set

data.table

intercept

Should a constant column be added? (logical, default to FALSE)

all_cols

For each factor, should we create all possible dummies, or should we drop a reference dummy? (logical, default to FALSE)

sparse

Should the resulting matrix be of a (sparse) Matrix class? (logical, default to FALSE)


ELToulemonde/dataPreparation documentation built on July 19, 2023, 11:45 a.m.