equal_freq.Rd
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.
#> Min. 1st Qu. Median Mean 3rd Qu. Max. #> 29.00 48.00 56.00 54.44 61.00 77.00#> [29,43) [43,46) [46,51) [51,54) [54,57) [57,59) [59,61) [61,63) [63,67) [67,77] #> 36 27 31 33 35 36 26 19 34 26#> [29,46) [46,54) [54,59) [59,63) [63,77] #> 63 64 71 45 60