Learn R Programming

HistogramTools (version 0.3.2)

AddHistograms: Aggregate histograms that have identical breaks.

Description

Aggregate histogram objects that have identical breaks.

Usage

AddHistograms(..., x=list(...), main=.NewHistogramName(x)) .NewHistogramName(x)

Arguments

...
Histogram objects (created by hist).
x
A list of histogram objects. If x is supplied then the ... are ignored.
main
A title to add to the aggregated/merged histogram. By default, if two histograms are provided a title will be created that includes the names of the original histograms. If more histograms are provided the title will simply include the number of aggregated histograms.

Details

This function adds the buckets of the provided histograms to return a single aggregated histogram.

.NewHistogramName is a utility that takes the list of histogram objects to be aggregated and returns a name for the new merged histogram. It is normally hidden, but can be viewed using HistogramTools:::.NewHistogramName.

See Also

histogramtools-package and hist.

Examples

Run this code
hist.1 <- hist(c(1,2,3,4), plot=FALSE)
hist.2 <- hist(c(1,2,2,4), plot=FALSE)
hist.sum <- AddHistograms(hist.1, hist.2)
hist.3 <- hist(c(1,2,2,4), plot=FALSE)
hist.sum <- AddHistograms(hist.1, hist.2, hist.3)

Run the code above in your browser using DataLab