Skip to contents

Annotate a dataframe with epiweek and epiyear columns with an epidate column.

Usage

with_epidate(
  df,
  epiweek_col = "epiweek",
  epiyear_col = "epiyear",
  epidate_name = "epidate",
  day_of_week = 1,
  epiweek_standard = "USA",
  validate = TRUE
)

Arguments

df

data frame to annotate.

epiweek_col

Name of the column containing epiweek values. Default "epiweek".

epiyear_col

Name of the column containing epiyear values. Default "epiyear".

epidate_name

Name for the output column containing the associated "epidates". Default "epidate".

day_of_week

Which day of the epidemiological week to use for the epidate. 1-indexed. Passed to epiweek_to_date(). Default 1 (start date of the epiweek).

epiweek_standard

Which epiweek standard to use. Passed to epiweek_to_date(). Default "USA".

validate

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

Value

The data frame annotated with the epidate column.