util_optimize_histogram_bins: Utility function to compute and optimize bin breaks for...

View source: R/util_optimize_histogram_bins.R

util_optimize_histogram_binsR Documentation

Utility function to compute and optimize bin breaks for histograms

Description

Utility function to compute and optimize bin breaks for histograms

Usage

util_optimize_histogram_bins(
  x,
  interval_freedman_diaconis = NULL,
  nbins_max = 100,
  cuts = NULL
)

Arguments

x

a vector of data values (numeric or datetime)

interval_freedman_diaconis

range of values which should be included to calculate the Freedman-Diaconis bandwidth (e.g., for con_limit_deviations only values within limits) in interval notation (e.g., ⁠[0;100]⁠)

nbins_max

the maximum number of bins for the histogram. Strong outliers can cause too many narrow bins, which might be even to narrow to be plotted. This also results in large files and rendering problems. So it is sensible to limit the number of bins. The function will produce a message if it reduces the number of bins in such a case. Reasons could be unspecified missing value codes, or minimum or maximum values far away from most of the data values, a few number of unique values, or (for con_limit_deviations) no or few values within limits.

cuts

a vector of values at which breaks between bins should occur

Value

a list with bin breaks, if needed separated for each segment of the plot

See Also

Other figure_functions: util_heatmap_1th()


dataquieR documentation built on May 29, 2024, 7:18 a.m.