Description Usage Arguments Details Value Author(s) See Also Examples
View source: R/functions-binning.R
Calculate breaks for same-sized bins for data values
breaks_on_nBins(fromX, toX, nBins, shiftByHalfBinSize = FALSE)
numeric(1) specifying the lowest value for the bins.
numeric(1) specifying the largest value for the bins.
numeric(1) defining the number of bins.
Logical indicating whether the bins should be shifted
left by half bin size. This results centered bins, i.e. the first bin being
This generates bins such as a call to
seq(fromX, toX, length.out = nBins) would. The first and second element
in the result vector thus defines the lower and upper boundary for the first
bin, the second and third value for the second bin and so on.
A numeric vector of length
nBins + 1 defining the lower and
upper bounds of the bins.
binYonX for a binning function.
Other functions to define bins:
1 2 3 4
## Create breaks to bin values from 3 to 20 into 20 bins breaks_on_nBins(3, 20, nBins = 20) ## The same call but using shiftByHalfBinSize breaks_on_nBins(3, 20, nBins = 20, shiftByHalfBinSize = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.