generateCube {hypercube}R Documentation

Generates a hypercube from a given dataframe

Description

This function generates a hypercube from a given dataframe. The dimensions of the hypercube correspond to a set of selected columns from the dataframe.

Usage

generateCube(
  data,
  columns,
  valueColumn,
  fun = c("sum", "min", "max", "prod", "mean", "median", "sd", "count")
)

Arguments

data

A dataframe that is used as source for the hypercube.

columns

A vector of column names that will form the dimensions of the hypercube.

valueColumn

The name of the column that provides the values for the cells of the hypercube.

fun

Aggregation function for aggregating over those columns that do not correspond with any dimension of the hypercube.

Value

Returns a Cube object.

Author(s)

Michael Scholz michael.scholz@th-deg.de

See Also

Cube

Examples


data("sales")
cube = generateCube(sales, columns = list(time = c("month", "year"),
      location = c("state"), product = "product"), valueColumn = "amount")


[Package hypercube version 0.2.1 Index]