add.aggregation: Adds an aggregation to a hypercube

Description Usage Arguments Value Author(s) See Also Examples

Description

This function adds a further aggregation to a hypercube. The cube itself will not be changed. The aggregation only affect the data that will be shown when printing the cube. Note that selection criteria will be applied before aggregating the data.

Usage

1
2
3
4
5
add.aggregation(
  x,
  dimensions,
  fun = c("sum", "min", "max", "prod", "mean", "median", "sd", "count")
)

Arguments

x

Hypercube for which the selection criteria will be defined.

dimensions

A vector of dimensions that are used in the aggregation.

fun

The function that is used for aggregation. Possible functions are sum, prod, min, max, mean, median, sd, and count.

Value

Returns a Cube object with the added aggregation.

Author(s)

Michael Scholz michael.scholz@th-deg.de

See Also

Cube remove.aggregation add.selection

Examples

1
2
3
4
5
data("sales")
cube = generateCube(sales, columns = list(time = c("month", "year"),
      location = c("state"), product = "product"), valueColumn = "amount")
cube = add.aggregation(cube, dimensions = c("month", "year"), fun = "sum")
cube

hypercube documentation built on March 26, 2020, 7:52 p.m.