Description Usage Arguments Value See Also Examples
Simple equal depth binning algorithm.
1 2 | depthbin(ser, nbins = 10, qtype = 7, digits = 10, labelRange = T,
labelPct = F, labelOrder = F)
|
ser |
numeric vector to bin |
nbins |
number of bins desired |
qtype |
an integer between 1 and 9 selecting one of the nine quantile algorithms detailed below to be used. See |
digits |
number, number of digits to display in bin categories |
labelRange |
logical: |
labelPct |
logical: |
labelOrder |
logical: |
ordered factor vector with bins
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | ## perfect equal depth bins
x1 <- rnorm(1000, 0, 20)
binned1 <- depthbin(x1, nbins=10)
table(binned1)
## slightly uneven bins with integer data
x2 <- rpois(1000, 3)
binned2 <- depthbin(x2, nbins=5)
summary(binned2)
## as good as we can get with skewed integer data
x3 <- round(abs(log(abs(rnorm(1000)))))
binned3 <- depthbin(x3, nbins=5)
summary(binned3)
## including more information in category names (levels of factor variable)
x4 <- round(abs(log(abs(rnorm(1000)))))
binned4 <- depthbin(x4, nbins=3, labelRange=T, labelPct=T, labelOrder=T)
summary(binned4)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.