When the dimension is defined as a date type, using this function we can select the day level and its attributes to include in it: date, month_day, week_day, quarter_day and year_day.
Usage
select_day_level(
td,
include_all,
exclude_all,
date,
month_day,
week_day,
day_name,
day_num_name,
day_abbr,
day_num_abbr,
quarter_day,
year_day
)
# S3 method for when
select_day_level(
td,
include_all = FALSE,
exclude_all = FALSE,
date = NULL,
month_day = NULL,
week_day = NULL,
day_name = NULL,
day_num_name = NULL,
day_abbr = NULL,
day_num_abbr = NULL,
quarter_day = NULL,
year_day = NULL
)
Arguments
- td
A
when
object.- include_all
A boolean, include all fields of the level.
- exclude_all
A boolean, exclude all fields of the level.
- date
A boolean, include the date.
- month_day
A boolean, include the day number in the month.
- week_day
A boolean, the day number in the week.
- day_name
A boolean, include the name of the day of the week.
- day_num_name
A boolean, include the number and name of the day of the week.
- day_abbr
A boolean, include the name of the day of the week in abbreviated version.
- day_num_abbr
A boolean, include the number and name of the day of the week in abbreviated version.
- quarter_day
A boolean, include the number of the day in the quarter.
- year_day
A boolean, include the number of the day in the year.
Details
The include_all
and exclude_all
parameters allow us to include or exclude
all attributes, and then specifically exclude or include the ones we need.
For the week_day we have the day number, its name and the name abbreviation. So that the order of the names corresponds to the alphabetical order, the combination of day number and name and/or abbreviation is included.
See also
Other dimension definition:
define_characteristics()
,
define_instances()
,
get_attribute_definition_function()
,
get_day_part()
,
get_week_date_range()
,
select_date_levels()
,
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() |>
select_day_level(day_abbr = FALSE,
day_num_abbr = FALSE)