library(efun)
#> 
#> Attaching package: 'efun'
#> The following object is masked from 'package:base':
#> 
#>     attr

Discretize

x <- rnorm(20)
discretize(x, method = "quantile")
#>  [1] -0.38 0.56  -1.45 0.56  2.07  2.07  -1.45 -0.03 -0.03 -0.03 -0.38 2.07 
#> [13] 2.07  -1.45 0.56  -1.45 -0.38 -0.03 0.56  -0.38
#> Levels: -1.45 < -0.38 < -0.03 < 0.56 < 2.07
discretize(x, method = "jenks")
#>  [1] -0.91 1.15  -1.63 -0.01 1.15  1.15  -1.63 -0.01 -0.01 -0.01 -0.01 1.15 
#> [13] 2.07  -1.63 1.15  -1.63 -0.01 -0.01 1.15  -0.91
#> Levels: -1.63 < -0.91 < -0.01 < 1.15 < 2.07
discretize(x, method = "isowidth")
#>  [1] -0.64 0.26  -1.54 0.26  1.16  1.16  -1.54 0.26  0.26  0.26  0.26  1.16 
#> [13] 2.07  -1.54 1.16  -1.54 0.26  0.26  1.16  -0.64
#> Levels: -1.54 < -0.64 < 0.26 < 1.16 < 2.07

Plots

denstogram()

denstogram(data = ggplot2::diamonds, xvar = price)