# Seriously skewed x:
x <- floor(exp(rnorm(200000 * 1.3)))
cuts <- bins(x, target.bins = 10, minpts = 2000)
cuts$breaks <- bins.getvals(cuts)
cuts$binct
# [0, 0] [1, 1] [2, 2] [3, 3] [4, 4] [5, 5] [6, 7] [8, 10]
# 129868 66611 28039 13757 7595 4550 4623 2791
# [11, 199]
# 2166
# Centered x:
x <- rep(c(1:10,20,31:40), c(rep(1, 10), 100, rep(1,10)))
cuts <- bins(x, target.bins = 3, minpts = 10)
cuts$binct
# [1, 10] [20, 20] [31, 40]
# 10 100 10Run the code above in your browser using DataLab