fhistogram: Fast Histogram Calculation

fhistogram-methodsR Documentation

Fast Histogram Calculation

Description

Returns an object of class Histogram. The method can be called recursively. This way more than one dataset can be binned into one histogram. Set shrink to TRUE only when the method is called for the last time to optimize the size of the object. The method is memory consuming.

Usage

## S4 method for signature 'Histogram'
fhistogram(x = NULL, Dataset = data.frame(),
           K = numeric(), ymin = numeric(), ymax = numeric(), 
           shrink = FALSE, ...)
## ... and for other signatures

Arguments

x

an object of class Histogram.

Dataset

a data frame of size n \times d containing d-dimensional dataset. Each of the d columns represents one random variable. Number of observations n equals the number of rows in the dataset.

K

an integer or a vector of length d containing numbers of bins v.

ymin

a vector of length d containing minimum observations.

ymax

a vector of length d containing maximum observations.

shrink

logical. If TRUE the output is shrank to its optimal size. The default value is FALSE.

...

currently not used.

Methods

signature(x = "Histogram")

an object of class Histogram.

Author(s)

Marko Nagode

Examples


# Create three datasets.

set.seed(1)

n <- 15

Dataset1 <- as.data.frame(cbind(rnorm(n, 157, 8), rnorm(n, 71, 10)))
Dataset2 <- as.data.frame(cbind(rnorm(n, 244, 14), rnorm(n, 61, 29)))
Dataset3 <- as.data.frame(cbind(rnorm(n, 198, 8), rnorm(n, 252, 13)))

apply(Dataset1, 2, range)
apply(Dataset2, 2, range)
apply(Dataset3, 2, range)

# Bin the first dataset.

hist <- fhistogram(Dataset = Dataset1, K = c(4, 5), ymin = c(100.0, 0.0), ymax = c(300.0, 300.0))

# Bin the second dataset.

hist <- fhistogram(x = hist, Dataset = Dataset2)

# Bin the third dataset and shrink the hist object.

hist <- fhistogram(x = hist, Dataset = Dataset3, shrink = TRUE)

hist

rebmix documentation built on July 26, 2023, 5:32 p.m.