Skip to contents

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 to epiyear_first_date(). Not case-sensitive. Default "USA"

validate

Validate the answer by passing it back to lubridate::epiweek() and lubridate::epiyear()? Boolean, default TRUE.

Value

The date, as a lubridate::date object

Details

By default returns the first date of the epiweek, but can return any date in the epiweek. Two standard definitions of epidemiological weeks and years are supported: USA CDC / MMWR ("USA", the default) and ISO ("ISO").