dateToEpiweek: Convert Calendar Dates to Epidemiological Weeks

Description Usage Arguments Value Author(s) Examples

View source: R/epiweek.R

Description

This function calculates the year and epidemiological week for a given calendar date. By definition, the first epidemiological week of the year contains at least four days in January.

Usage

1
dateToEpiweek(date, format = "%Y-%m-%d", firstday = "Sunday")

Arguments

date

A character string for calendar date.

format

A character string specifying the input format for date. The default for the format methods is "%Y-%m-%d".

firstday

A character string specifying the beginning weekday for each epidemiological week. The default for the firstday methods is "Sunday".

Value

year

Epidemiological year

weekno

Epidemiological week

Author(s)

Xiahong Zhao

Examples

1
2
3
dateToEpiweek("2015-01-06")
dateToEpiweek("2015-Jan-06",format="%Y-%b-%d")
dateToEpiweek("Feb-15-2016",format="%b-%d-%Y",firstday="Monday")

Example output

$year
[1] 2015

$weekno
[1] 1

$year
[1] 2015

$weekno
[1] 1

$year
[1] 2016

$weekno
[1] 7

EpiWeek documentation built on May 30, 2017, 4:57 a.m.