breaks: Generate Break Points for Equidistant or Quantile Bins
Description
Creates a numeric vector of break points for the given data x.
The resulting breaks define bins that are either equidistant (fixed width)
or non-equidistant (quantile-based). If width is not specified, it defaults
to diff(pretty(x))[1]. The probs argument can either be a single
integer, specifying the number of quantiles, or a numeric vector of probabilities
in the interval \([0, 1]\).
Usage
breaks(x, width = NULL, probs = NULL)
add_breaks(x, width = NULL, probs = NULL)
dbreaks(x, width = NULL, probs = NULL)
Value
A numeric vector containing the break points.
Arguments
x
numeric vector: the data to compute breaks for.
width
numeric, optional: desired bin width (default: NULL, auto-calculated).
probs
numeric, optional: number of quantiles (single integer) or
vector of probabilities in \([0, 1]\) for non-equidistant bins (default: NULL).
Details
If probs is used, break points are rounded to the nearest multiple of width.
Duplicates are removed, and the range is extended if necessary to include the
full range of x.