Learn R Programming

dataPreparation (version 0.4.3)

setAsNumericMatrix: 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 binarized. It may be sparsed, include an intercept, and drop a reference column for each factor if required (when using lm(), for instance)

Usage

setAsNumericMatrix(dataSet, intercept = FALSE, allCols = FALSE, sparse = FALSE)

Arguments

dataSet

data.table

intercept

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

allCols

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)