centers, scales and Yeo Johnson transforms numeric variables in a dataframe before binning into n bins of equal range. Outliers based on boxplot stats are capped (set to min or max of boxplot stats).
manip_bin_numerics(
x,
bins = 5,
bin_labels = c("LL", "ML", "M", "MH", "HH"),
center = T,
scale = T,
transform = T,
round_numeric = T,
digits = 2,
NA_label = "NA"
)
dataframe with numeric variables, or numeric vector
number of bins for numerical variables, Default: 5
labels for the bins from low to high, Default: c("LL", "ML", "M", "MH", "HH"). Can also be one of c('mean', 'median', 'min_max', 'cuts'), the corresppnding summary function will supply the labels.
logical, Default: T
logical, Default: T
logical, apply Yeo Johnson Transformation, Default: T
logical, rounds numeric results if bin_labels is supplied with a supported summary function name.
integer, number of digits to round to
character vector, define label for missing data, Default: 'NA'
dataframe
# NOT RUN {
summary( mtcars2 )
summary( manip_bin_numerics(mtcars2) )
summary( manip_bin_numerics(mtcars2, bin_labels = 'mean'))
summary( manip_bin_numerics(mtcars2, bin_labels = 'cuts'
, scale = FALSE, center = FALSE, transform = FALSE))
# }
Run the code above in your browser using DataLab