To bin a univariate data set in to a consecutive bins.
Usage
binning(x, counts, nclass, breaks, bw)
Arguments
x
A vector of raw data. 'NA' values will be automatically
removed.
counts
Frequencies or counts of observations in different
classes (bins)
nclass
Number of classes
breaks
The break points for data binning.
bw
Bin (class) width.
Details
Data binning can be done in the following cases:
(1) both x and breaks are specified;
(2) both counts and breaks are specified;
(3) both x and bw are specified.
If (3a) breaks is of length 1, it gives the lower limit
of the first bin/class, and a sequence of equal-width bins will
be defined.
If (3b) breaks is missing, a random starting point will
be chosen.