This function lets the user quickly calculate cuts for quantiles and discretize numerical values into categorical values.
Value
Factor vector or data.frame. Depending on return
input:
labels
a factor ordered vector with each observation's quantilesummary
a data.frame with information on each quantile cut
See also
Other Data Wrangling:
balance_data()
,
categ_reducer()
,
cleanText()
,
date_cuts()
,
date_feats()
,
file_name()
,
formatHTML()
,
holidays()
,
impute()
,
left()
,
normalize()
,
num_abbr()
,
ohe_commas()
,
ohse()
,
removenacols()
,
replaceall()
,
replacefactor()
,
textFeats()
,
textTokenizer()
,
vector2text()
,
year_month()
,
zerovar()
Other Calculus:
corr()
,
dist2d()
,
model_metrics()
Examples
data(dft) # Titanic dataset
quants(dft$Age, splits = 5, "summary")
#> percentile cut label
#> 20% 20% 19.0 [19-19]
#> 40% 40% 25.0 (19-25]
#> 60% 60% 31.8 (25-32]
#> 80% 80% 41.0 (32-41]
#> 100% 100% 80.0 (41-80]
quants(dft$Age, splits = 5, "labels")[1:10]
#> [1] (19,25] (32,41] (25,32] (32,41] (32,41] <NA> (41,80]
#> [8] [0.42,19] (25,32] [0.42,19]
#> Levels: [0.42,19] < (19,25] < (25,32] < (32,41] < (41,80]