| quants {lares} | R Documentation |
Calculate cuts by quantiles
Description
This function lets the user quickly calculate cuts for quantiles and discretize numerical values into categorical values.
Usage
quants(values, splits = 10, return = "labels", n = 2)
Arguments
values |
Vector. Values to calculate quantile cuts |
splits |
Integer. How many cuts should split the values? |
return |
Character. Return "summary" or "labels" |
n |
Integer. Determines the number of digits used in formatting the break numbers. |
Value
Factor vector or data.frame. Depending on return input:
-
labelsa factor ordered vector with each observation's quantile -
summarya 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")
quants(dft$Age, splits = 5, "labels")[1:10]