lookup_table {rolap}R Documentation

Transform a flat table into a look up table

Description

Checks that the given attributes form a primary key of the table. Otherwise, group the records so that they form a primary key. To carry out the groupings, aggregation functions for attributes and measures must be provided.

Usage

lookup_table(
  ft,
  pk_attributes,
  attributes,
  attribute_agg,
  measures,
  measure_agg
)

## S3 method for class 'flat_table'
lookup_table(
  ft,
  pk_attributes = NULL,
  attributes = NULL,
  attribute_agg = NULL,
  measures = NULL,
  measure_agg = NULL
)

Arguments

ft

A flat_table object.

pk_attributes

A vector of strings, attribute names.

attributes

A vector of strings, rest of attribute names.

attribute_agg

A vector of strings, attribute aggregation functions.

measures

A vector of strings, measure names.

measure_agg

A vector of strings, measure aggregation functions.

Details

If the table does not have measures, attributes with equal values are grouped without the need to indicate a grouping function.

If no attribute is indicated, all the attributes are considered to form the primary key.

Value

A flat_table object.

See Also

flat_table

Other flat table join functions: check_lookup_table(), get_pk_attribute_names(), join_lookup_table()

Examples


ft <- flat_table('iris', iris) |>
  lookup_table(
    measures = c("Sepal.Length", "Sepal.Width", "Petal.Length", "Petal.Width"),
    measure_agg = c('MAX', 'MIN', 'SUM', 'MEAN')
  )


[Package rolap version 2.5.1 Index]