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,
  iqr_bw,
  n_bw,
  min_within = NULL,
  max_within = NULL,
  min_plot = NULL,
  max_plot = NULL,
  nbins_max = NULL
)

Arguments

x

a vector of data values (numeric or datetime)

iqr_bw

the interquartile range of values which should be included to calculate the Freedman-Diaconis bandwidth (e.g., for con_limit_deviations only values within limits)

n_bw

the number of values which should be included to calculate the Freedman-Diaconis bandwidth (e.g., for con_limit_deviations the number of values within limits)

min_within

the minimum value which is still within limits (needed for con_limit_deviations)

max_within

the maximum value which is still within limits (needed for con_limit_deviations)

min_plot

the minimum value which should be included in the plot

max_plot

the maximum value which should be included in the plot

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 warning 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, or (for con_limit_deviations) no or few values within limits.

Value

a list with bin breaks below, within and above limits


dataquieR documentation built on July 26, 2023, 6:10 p.m.