A standard histogram using getbw to compute the binwidth and breakpoints.

ahist(x, k = NULL, m = NULL, fun = "qplot", col = "grey", ival = NULL)

Arguments

x

A numeric vector.

k

The desired number of active bins. A bin is active if it contains at least min_n observations. The default is k <- 1 + 2*ceiling(log(N)/log(2)).

m

The minimum number of observations necessary for a bin to count as an active bin. Defaults to m = max(log(N/10)/log(10),1).

fun

Either "qplot" or "hist".

col

The color for the bars.

ival

If this is set to a numeric value in (0,1) then x is trimmed according to innerval(x, p = ival).

Value

The ggplot object.

Note

This is purely experimental at this time.

See also

Examples

ahist(rnorm(100))
#> Warning: `geom_bar()` no longer has a `binwidth` parameter. Please use `geom_histogram()` instead.
ahist(rnorm(1000))
#> Warning: `geom_bar()` no longer has a `binwidth` parameter. Please use `geom_histogram()` instead.
ahist(rnorm(10000))
#> Warning: `geom_bar()` no longer has a `binwidth` parameter. Please use `geom_histogram()` instead.
ahist(rexp(100))
#> Warning: `geom_bar()` no longer has a `binwidth` parameter. Please use `geom_histogram()` instead.
ahist(rexp(1000))
#> Warning: `geom_bar()` no longer has a `binwidth` parameter. Please use `geom_histogram()` instead.
ahist(rexp(10000))
#> Warning: `geom_bar()` no longer has a `binwidth` parameter. Please use `geom_histogram()` instead.
# NOT RUN { ahist(rcauchy(1000)) ahist(rcauchy(1000), ival = 0.95) x <- c(rnorm(400),rnorm(200, mean=6)) ahist(x) x <- c(rnorm(400),rnorm(200, mean=16)) ahist(x) x <- c(rnorm(400),rnorm(200, mean=32)) ahist(x) # }