mmwr_weekday: Convert a Date to an MMWR weekday

View source: R/mmwr-map.r

mmwr_weekdayR Documentation

Convert a Date to an MMWR weekday

Description

This is a reformat and re-export of a function in the MMWRweek package. It provides a snake case version of its counterpart, produces a factor of weekday names (Sunday-Saturday).

Usage

mmwr_weekday(x, abbr = FALSE)

Arguments

x

a vector of Date objects or a character vector in YYYY-mm-dd format.

abbr

(logical) if TRUE, return abbreviated weekday names, otherwise full weekday names (see Note).

Value

ordered factor

Note

Weekday names are explicitly mapped to "Sunday-Saturday" or "Sun-Sat" and do not change with your locale.

Examples

mwday <- mmwr_weekday(Sys.Date())

hrbrmstr/cdcfluview documentation built on Nov. 25, 2022, 7:55 p.m.