manip_bin_numerics | R Documentation |
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"
)
x |
dataframe with numeric variables, or numeric vector |
bins |
number of bins for numerical variables, passed to cut as breaks parameter, Default: 5 |
bin_labels |
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 corresponding summary function will supply the labels. |
center |
logical, Default: T |
scale |
logical, Default: T |
transform |
logical, apply Yeo Johnson Transformation, Default: T |
round_numeric |
logical, rounds numeric results if bin_labels is supplied with a supported summary function name. |
digits |
integer, number of digits to round to |
NA_label |
character vector, define label for missing data, Default: 'NA' |
dataframe
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))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.