Skip to contents

Get the starting or ending day of the epidemiological week ("epiweek") according to different epiweek standards. Returns the day of the week index as an integer that can be passed to lubridate functions as a day-of-the-week index (e.g. as the week_start argument to lubridate::wday()): 1 for Monday, 2 for Tuesday, ... 7 for Sunday.

Usage

epiweek_start(epiweek_standard)

epiweek_end(epiweek_standard)

Arguments

epiweek_standard

One of "MMWR" or "USA" (USA / MMWR epiweek, starts on Sunday) and "ISO" (ISO week, starts on Monday). Not case-sensitive.

Value

the start day of the week for the epiweek standard, as an integer that can be passed to lubridate::wday() as the week_start argument.

Examples

epiweek_start("ISO")
#> [1] 1
epiweek_end("iso")
#> [1] 7
epiweek_start("MMWR")
#> [1] 7
epiweek_end("usa")
#> [1] 6