Skip to contents

Rename the attributes of the dimension table. It is especially useful if we want to export the table, for example, to a database.

Usage

set_table_attribute_names(td, names)

# S3 method for when
set_table_attribute_names(td, names = NULL)

Arguments

td

A when object.

names

A string vector.

Value

A when object.

Examples


wd <- when() |>
  generate_table()
wd |>
  get_table_attribute_names()
#> [1] "c('id', 'date', 'month_day', 'week_day', 'day_name', 'day_num_name', 'year_week', 'week', 'year_month', 'month', 'month_name', 'month_num_name', 'year')"

wd <- wd |>
  set_table_attribute_names(
    c(
      'id_when',
      'date',
      'month_day',
      'week_day',
      'day_name',
      'day_num_name',
      'year_week',
      'week',
      'year_month',
      'month',
      'month_name',
      'month_num_name',
      'year'
    )
  )