Description Usage Arguments Value Examples
Equal frequency tries to put the same quantity of cases per bin when possible. It's a wrapper of function cut2 from Hmisc package.
1 | 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.
1 2 3 4 5 6 7 8 | ## 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)
|
Loading required package: Hmisc
Loading required package: lattice
Loading required package: survival
Loading required package: Formula
Loading required package: ggplot2
Attaching package: 'Hmisc'
The following objects are masked from 'package:base':
format.pval, round.POSIXt, trunc.POSIXt, units
sh: 1: cannot create /dev/null: Permission denied
funModeling v.1.6.5 :)
Examples and tutorials at livebook.datascienceheroes.com
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
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.