Learn R Programming

dataPreparation (version 0.1)

findAndTransformNumerics: Identify numeric columns in a dataSet set

Description

Function to find and transform characters that are in fact numeric.

Usage

findAndTransformNumerics(dataSet, n_test = 30, verbose = TRUE)

Arguments

dataSet

Matrix, data.frame or data.table

n_test

Number of non-null rows on which to test (numeric, default to 30)

verbose

Should the algorithm talk? (logical, default to TRUE)

Value

The dataSet set (as a data.table) with identified numeric transformed.

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.

Details

This function is looking for perfect transformation. If there are some mistakes in dataSet, consider setting them to NA before.

Examples

Run this code
# NOT RUN {
# Let's build a dataSet set
dataSet <- data.frame(ID = 1:5,
                  col1 = c("1.2", "1.3", "1.2", "1", "6"), 
                  col2 = c("1,2", "1,3", "1,2", "1", "6")
                  )

# using the findAndTransformNumerics
findAndTransformNumerics(dataSet, n_test = 5)
# }

Run the code above in your browser using DataLab