ahist: Histogram using active bins

Description Usage Arguments Value Note Author(s) See Also Examples

View source: R/getbw.R

Description

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

Usage

1
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.

Author(s)

Alexander Pilhoefer

See Also

getbw, cutbw

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
ahist(rnorm(100))
ahist(rnorm(1000))
ahist(rnorm(10000))


ahist(rexp(100))
ahist(rexp(1000))
ahist(rexp(10000))


## 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)

## End(Not run)

Example output

Warning message:
`geom_bar()` no longer has a `binwidth` parameter. Please use `geom_histogram()` instead. 
Warning message:
`geom_bar()` no longer has a `binwidth` parameter. Please use `geom_histogram()` instead. 
Warning message:
`geom_bar()` no longer has a `binwidth` parameter. Please use `geom_histogram()` instead. 
Warning message:
`geom_bar()` no longer has a `binwidth` parameter. Please use `geom_histogram()` instead. 
Warning message:
`geom_bar()` no longer has a `binwidth` parameter. Please use `geom_histogram()` instead. 
Warning message:
`geom_bar()` no longer has a `binwidth` parameter. Please use `geom_histogram()` instead. 
Warning message:
`geom_bar()` no longer has a `binwidth` parameter. Please use `geom_histogram()` instead. 
Warning message:
`geom_bar()` no longer has a `binwidth` parameter. Please use `geom_histogram()` instead. 
Warning message:
`geom_bar()` no longer has a `binwidth` parameter. Please use `geom_histogram()` instead. 
Warning message:
`geom_bar()` no longer has a `binwidth` parameter. Please use `geom_histogram()` instead. 
Warning message:
`geom_bar()` no longer has a `binwidth` parameter. Please use `geom_histogram()` instead. 

extracat documentation built on July 17, 2018, 5:05 p.m.

Related to ahist in extracat...