epi_week: Date Conversion to Epidemiological Weeks

Description Usage Arguments Details Value See Also Examples

Description

Function to calculate the epidemiological weeks in which one or more calendar dates fall.

Usage

1
epi_week(x, system = "who", ...)

Arguments

x

A Date vector, or another vector that can be converted to Date using as.Date

system

Either "who" or "cdc". WHO epidemiological weeks start on Monday. CDC epidemiological weeks (MMWR weeks) start on Sunday

...

Additional parameters passed to as.Date

Details

The function first converts date to a Date object using the function as.Date(). I welcome suggestions for making this more robust.

Value

A data frame with columns labeled epi_week and epi_year. The object also has class tbl_df and tbl for use with the dplyr package.

See Also

Other epi.calendar.functions: add_epi_week; epi_week_date; epi_year_start

Examples

1
2
3
epi_week("2015-01-01")
epi_week("2015-150", format = "%Y-%j")
epi_week(seq(as.Date("2014-12-26"), as.Date("2015-01-12"), by = "day"))

chrismerkord/epical documentation built on May 13, 2019, 6:55 p.m.