histOverlap: Count number of values in overlapping bins

histOverlapR Documentation

Count number of values in overlapping bins

Description

Histogram of number of values in overlapping bins.

Usage

histOverlap(x, breaks, right = TRUE, graph = TRUE, indices = FALSE)

Arguments

x

Numeric values.

breaks

One integer, three numeric values, or a matrix or data frame with at least two columns:

  • Single integer: The number of overlapping bins into which to enumerate values of x. The range of x covered by the bins bins will extend from the least value minus 2.5 percent of the range to the largest value plus 2.5 percent of the range.

  • Three numeric values: The first two values are the range of covered by the bins (least and greatest). The third value is the number of bins.

  • Matrix or data frame with at least two columns. Each row corresponds to a different bin. The first column represents the minimum values of each bin and the second column the maximum value. Subsequent columns are ignored. Note that by using this option arbitrary bins can be used–they need not overlap or even be continuous in coverage.

right

Logical, if TRUE (default), then use left-open and right-closed intervals.

graph

Logical, if TRUE (default), then plot frequencies.

indices

Logical, if TRUE, then the output will have an attribute which is a list item with one element per bin in the output, with the indices of x that fall in each bin. Default is FALSE.

Value

Matrix

See Also

hist

Examples


set.seed(123)
x <- rnorm(1000)
histOverlap(x, breaks=10, graph=TRUE)
histOverlap(x, breaks=c(0, 1, 10), graph=TRUE)
mat <- matrix(c(seq(0, 1, by=0.1), seq(0.3, 1.3, by=0.1)), ncol=2)
histOverlap(x, breaks=mat, graph=TRUE)
histOverlap(x, breaks=mat, indices=TRUE)


adamlilith/statisfactory documentation built on Jan. 3, 2024, 10:37 p.m.