chop {ggplot2} | R Documentation |
Chop a continuous variable into a categorical variable.
chop(x, n = 10, width = NULL, method="quantiles", midpoint=0, digits=2, ...)
x |
continuous variable to chop into pieces |
n |
number of bins to chop into |
width |
method to use: quantiles (approximately equal numbers), cut (equal lengths) or pretty |
method |
mid point for diverging factors |
midpoint |
other arguments passed to format |
digits |
|
... |
Chop provides a convenient interface for discretising a continuous variable.
It will break up a continuous variable into chunks with equal numbers of
points (method = "quantiles"
) or equal ranges (
method = "cut"
). You can specify the number of bins, with n
,
or the "width" of each bin, with width
Hadley Wickham <h.wickham@gmail.com>
round_any
, chop.breaks
to get breaks used