shingles: Cleveland-Style Shingles

View source: R/utils.R

shinglesR Documentation

Cleveland-Style Shingles

Description

Shingles are a generalization of factors to continuous variables. Cleveland-style shingles distribute the range of a continuous variable into overlapping discrete intervals, which can be more useful for visualization than mutually-exclusive bins.

Usage

shingles(x, breaks, overlap = 0.5, labels = NULL)

Arguments

x

A numeric vector.

breaks

Either the number of intervals or a matrix of breaks (as returned by co.intervals).

overlap

The fraction of overlap between intervals.

labels

The names of the intervals.

Value

A list giving the indices of x in each shingle with the following attributes:

  • breaks: A matrix where each row gives the lower and upper limits for each shingle.

  • counts: The number of observations in each shingle.

  • mids: The center of each shingle.

Author(s)

Kylie A. Bemis

References

W. S. Cleveland. Visualizing Data. New Jersey: Summit Press. 1993.

See Also

co.intervals

Examples

set.seed(1)
x <- rnorm(100)

shingles(x, 6)

kuwisdelu/matter documentation built on Oct. 19, 2024, 10:31 a.m.