define_dimension {rolap}R Documentation

Define dimension in a star_schema object.

Description

Dimensions are part of a star_schema object. They can be defined directly as a dimension_schema object or giving the name and a set of attributes.

Usage

define_dimension(
  schema,
  dimension,
  name,
  attributes,
  scd_nk,
  scd_t0,
  scd_t1,
  scd_t2,
  scd_t3,
  scd_t6,
  is_when,
  ...
)

## S3 method for class 'star_schema'
define_dimension(
  schema,
  dimension = NULL,
  name = NULL,
  attributes = NULL,
  scd_nk = NULL,
  scd_t0 = NULL,
  scd_t1 = NULL,
  scd_t2 = NULL,
  scd_t3 = NULL,
  scd_t6 = NULL,
  is_when = FALSE,
  ...
)

Arguments

schema

A star_schema object.

dimension

A dimension_schema object.

name

A string, name of the dimension.

attributes

A vector of attribute names.

scd_nk

A vector of attribute names, scd natural key.

scd_t0

A vector of attribute names, scd T0 attributes.

scd_t1

A vector of attribute names, scd T1 attributes.

scd_t2

A vector of attribute names, scd T2 attributes.

scd_t3

A vector of attribute names, scd T3 attributes.

scd_t6

A vector of attribute names, scd T6 attributes.

is_when

A boolean, is when dimension.

...

When dimension configuration parameters.

Value

A star_schema object.

See Also

star_database

Other star schema definition functions: define_facts(), dimension_schema(), fact_schema(), star_schema()

Examples


s <- star_schema() |>
  define_dimension(
    name = "when",
    attributes = c(
      "Week Ending Date",
      "WEEK",
      "Year"
    )
  )

s <- star_schema()
d <- dimension_schema(
  name = "when",
  attributes = c(
    "Week Ending Date",
    "WEEK",
    "Year"
  )
)
s <- s |>
  define_dimension(d)

[Package rolap version 2.5.1 Index]