define_characteristics {when}R Documentation

Define dimension characteristics

Description

With this function we can define the characteristics of the dimension that do not depend on the levels it includes, such as the name, type, location or the day the week begins. It also allows us to define whether the table includes a surrogate key.

Usage

define_characteristics(
  td,
  name,
  surrogate_key,
  type,
  locale,
  week_starts_monday
)

## S3 method for class 'when'
define_characteristics(
  td,
  name = NULL,
  surrogate_key = NULL,
  type = NULL,
  locale = NULL,
  week_starts_monday = NULL
)

Arguments

td

A when object.

name

A string, table name.

surrogate_key

A boolean, include a surrogate key in the dimension table.

type

A string, type of calendar (NULL, 'iso', 'epi' or 'time').

locale

A locale, to use for day and month names.

week_starts_monday

A boolean.

Details

The week_starts_monday parameter only affects the numbering of days, not weeks.

The week number associated with each date depends on the type of date dimension selected: standard ('date'), ISO 8601 ('iso') or epidemiological ('epi').

The standard week numbers blocks of 7 days beginning on January 1. The last week of the year can be less than 7 days long.

The ISO 8601 week numbers blocks of 7 days from Monday to Sunday. The first and last week of the year can contain days from the previous or next year.

The epidemiological week is like ISO 8601 only that it considers that the week begins on Sunday.

Value

A when object.

See Also

Other dimension definition: define_instances(), get_attribute_definition_function(), get_day_part(), get_week_date_range(), select_date_levels(), select_day_level(), select_month_level(), select_quarter_level(), select_semester_level(), select_time_level(), select_week_level(), select_year_level(), set_attribute_definition_function(), set_day_part(), when()

Examples


td <- when() |>
  define_characteristics(name = 'time', type = 'time')


[Package when version 1.0.0 Index]