Mirrors the C# Histogram class of the Numerics library. With bins = NULL the bin count
follows the Rice rule, ceiling(2 * n^(1/3)) + 1, exactly as the C# data constructor does.
Value
a data frame with columns lower, upper, midpoint, and frequency, carrying the
histogram's mean, median, mode, sd, and bin_width as attributes.
Examples
h <- histogram(c(1, 2, 2.5, 3, 3.5, 4, 5, 7, 8, 9))
h
#> lower upper midpoint frequency
#> 1 1.000000 2.333333 1.666667 2
#> 2 2.333333 3.666667 3.000000 3
#> 3 3.666667 5.000000 4.333333 1
#> 4 5.000000 6.333333 5.666667 1
#> 5 6.333333 7.666667 7.000000 1
#> 6 7.666667 9.000000 8.333333 2
attr(h, "mode")
#> [1] 3