bin {MIfuns} | R Documentation |
Given a numeric vector, calculate bin limits, place each value in a bin, and return the number of values in each bin.
bin(x, population = x, breaks = quantile(population, probs = c(0, 0.25, 0.5, 0.75, 1), ...), ...)
x |
A vector of numeric values, to be placed in bins. |
population |
A vector of numeric values serving as the reference population for constructing bins. |
breaks |
Bin limits (boundaries) to pass to cut(). |
... |
Other arguments to pass to quantile(), table(), or cut(). |
By default, the population used to calculate bin limits is the same as the group of values being binned. By default, inner bin limits are the quartiles of the population.
A table with bin limits encoded as column names.
Tim Bergsma
bin(1:100) bin(1:50,population=1:100) plot( bin( rnorm(1000), breaks=seq( from=-3, to=3, by=0.5 ) ) )