find_and_transform_numerics {dataPreparation} | R Documentation |
Identify numeric columns in a data_set set
Description
Function to find and transform characters that are in fact numeric.
Usage
find_and_transform_numerics(
data_set,
cols = "auto",
n_test = 30,
verbose = TRUE
)
Arguments
data_set |
Matrix, data.frame or data.table |
cols |
List of column(s) name(s) of data_set to look into. To check all all columns, set it to "auto". (characters, default to "auto") |
n_test |
Number of non-null rows on which to test (numeric, default to 30) |
verbose |
Should the algorithm talk? (logical, default to TRUE) |
Details
This function is looking for perfect transformation.
If there are some mistakes in data_set, consider setting them to NA before.
If there are some columns that have no chance to be a match think of removing them from cols
to save some computation time.
Value
The data_set set (as a data.table) with identified numeric transformed.
Warning
All these changes will happen by reference.
Examples
# Let's build a data_set set
data_set <- data.frame(ID = seq_len(5),
col1 = c("1.2", "1.3", "1.2", "1", "6"),
col2 = c("1,2", "1,3", "1,2", "1", "6")
)
# using the find_and_transform_numerics
find_and_transform_numerics(data_set, n_test = 5)
[Package dataPreparation version 1.1.1 Index]