quants: Calculate cuts by quantiles

quantsR 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:

  • labels a factor ordered vector with each observation's quantile

  • summary 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")
quants(dft$Age, splits = 5, "labels")[1:10]

laresbernardo/lares documentation built on Oct. 23, 2024, 12:05 p.m.