days_of_week: The days of the week

View source: R/days_of_week.R

days_of_weekR Documentation

The days of the week

Description

days_of_week returns a vector of the days of the week in full (e.g. "Friday") or abbreviated (e.g. "Fri") form. It exists because I'm lazy and don't like typing them all out.

Usage

days_of_week(abbr = FALSE)

Arguments

abbr

Logical. If FALSE, returns the days of the week in full form (e.g. "Friday"). If TRUE, it returns days in abbreviated form (e.g. "Fri"). The default value is FALSE.

Details

The Date and POSIXt classes within R treat Sunday as day 0 in a week, and Saturday as day 6. As a vector cannot have an element at position zero, days_of_week returns Sunday as its seventh element. The positions of the rest of the days within days_of_week are consistent with the order of the days of the week within the Date and POSIXt classes.

See Also

day_to_num for converting the output of days_of_week into numeric values.

n_day for calculating the number of occurrences of a day of the week in a set time period.

Examples

days_of_week()
days_of_week(abbr = TRUE)[3]


jackhannah95/jafun documentation built on Feb. 9, 2023, 12:24 p.m.