dttm_vars | R Documentation |
Computation of auxiliar date variables:
- mon_abb: a factor with the abbreviated name of the month;
- mon_lbl: a factor with the complete name of the month;
- mon_num: the number of the month;
- day_num: the number of the day within the month;
- year_num: the number of the year;
- year_lbl: the number of the year, bu as a factor;
- week_num: the number of complete seven day periods that have occurred between the date and January 1st, plus one;
- epiweek_num: the US CDC version of epidemiological week. Starts on Sunday;
- isoweek_num: the week as it would appear in the ISO 8601 system, which uses a reoccurring leap week. Starts on Monday;
- wday_abb: a factor with the week day abbreviated name;
- wday_lbl: a factor with the week day complete name.
dttm_vars(df, dt_var, prefix = NULL)
df |
A single data.frame |
dt_var |
A date variable from a data.frame |
prefix |
A character single value (default = NULL), that that will be added as the prefix for the computed variables |
A tibble with the original data and the new computed variables.
df <- data.frame(dt = lubridate::dmy("01/01/01"))
#without prefix
dplyr::glimpse(dttm_vars(df,dt))
#with prefix
dplyr::glimpse(dttm_vars(df,dt,"dt"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.