find_nbins: Compute a reasonable default number of bins.

Description Usage Arguments Value See Also Examples

View source: R/find_nbins.R

Description

Compute a reasonable default number of bins based on the data and different types of rules.

Usage

1
find_nbins(x, rule = c("FD", "RR", "Scott", "sqrt", "Sturges"), na_rm = TRUE)

Arguments

x

a numeric vector.

rule

a character string matching to a rule to use to determine number of bins.

na_rm

logical whether to remove (TRUE) missing values or not (FALSE)

Value

an integer with reasonable number of bins.

See Also

The following wiki for a discussion on different "rules-of-thumb". Additionally, the bigvis package and sources therein.

Examples

1
2
3
4
set.seed(42L)
find_nbins(rnorm(1000))
find_nbins(rnorm(1000), "Scott")
find_nbins(rnorm(1000), "sqrt")

tstev/tstevR documentation built on May 18, 2020, 10:57 p.m.