equal_freq | R Documentation |
Equal frequency tries to put the same quantity of cases per bin when possible. It's a wrapper of function cut2 from Hmisc package.
equal_freq(var, n_bins)
var |
input variable |
n_bins |
number of bins to split 'var' by equal frequency, if it not possible to calculate for the desired bins, it returns the closest number |
The binned variable.
## Example 1
summary(heart_disease$age)
age_2=equal_freq(var=heart_disease$age, n_bins = 10)
summary(age_2)
## Example 2
age_3=equal_freq(var=heart_disease$age, n_bins = 5)
summary(age_3)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.