Function to convert an epidemiological week and year ("epiweek" and "epiyear") pair to a date in a safe way.
Usage
epiweek_to_date(
epiweek,
epiyear,
day_of_week = 1,
epiweek_standard = "USA",
validate = TRUE
)
Arguments
- epiweek
Epidemiological week, as an integer (e.g.
46
)- epiyear
Epidemiological year, as an integer. (e.g.
2022
).- day_of_week
day of the epiweek whose date should be returned, as a 1-indexed integer, so 1 is the first date in the epiweek and 7 the last. Default
1
.- epiweek_standard
One of
"USA"
(USA epiweek, starts on Sunday) and"ISO"
(ISO week, starts on Monday). Passed toepiyear_first_date()
. Not case-sensitive. Default"USA"
- validate
Validate the answer by passing it back to
lubridate::epiweek()
andlubridate::epiyear()
? Boolean, defaultTRUE
.
Value
The date, as a
lubridate::date
object