Learn R Programming

dataPreparation (version 0.1)

shapeSet: Final preparation before ML algorithm

Description

Prepare a data.table by: - transforming numeric variables into factors whenever they take less than thresh unique variables - transforming characters into factors - transforming logicals into binary integers - dropping constant columns - Sending the data.table to setAsNumericMatrix() (when finalForm == "numerical_matrix") will then allow you to get a numerical matrix usable by most Machine Learning Algorithms.

Usage

shapeSet(dataSet, finalForm = "data.table", thresh = 10, verbose = TRUE)

Arguments

dataSet

Matrix, data.frame or data.table

finalForm

"data.table" or "numerical_matrix" (default to data.table)

thresh

numeric, threshold such that a numerical column is transformed into a factor whenever its number of unique modalities is smaller or equal to thresh (default to 10)

verbose

logical

Warning

All these changes will happen by reference: please send a copy() of your data.table to prepareSet if you do not want your original dataSet to be modified.