powered by
Cut data based on density.
density_cut(.x, .k, .lower = 0.1, .upper = 2, .step = 0.1)
A factor, see base::cut()
base::cut()
A numeric vector.
Numeric giving the number of expected clusters.
The interval for possible value of adjust.
A numeric giving the increment to adjust. Sometimes low values are needed to find a proper adjust value.
set.seed(1234) .x <- c(rnorm(200, 0, 1), rnorm(200, 0.8, 1)) .k <- 2 density_cut(.x, .k)
Run the code above in your browser using DataLab