MMWRweek: MMWR day, week, and year

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/MMWRweek.R

Description

This function returns the MMWR day, week, and year for the Date(s) provided.

Usage

1

Arguments

date

vector which can be coerced to class Date

Details

The first day of any MMWR week is Sunday. MMWR week numbering is sequential beginning with 1 and incrementing with each week to a maximum of 52 or 53. MMWR week #1 of an MMWR year is the first week of the year that has at least four days in the calendar year. For example, if January 1 occurs on a Sunday, Monday, Tuesday or Wednesday, the calendar week that includes January 1 would be MMWR week #1. If January 1 occurs on a Thursday, Friday, or Saturday, the calendar week that includes January 1 would be the last MMWR week of the previous year (#52 or #53). Because of this rule, December 29, 30, and 31 could potentially fall into MMWR week #1 of the following MMWR year.

Value

data.frame with elements MMWRday (of the week), MMWRweek, and MMWRyear

Author(s)

Jarad Niemi niemi@iastate.edu

References

http://wwwn.cdc.gov/nndss/document/MMWR_Week_overview.pdf

See Also

MMWRweekday, MMWRweek2Date

Examples

1
2
y = as.Date(paste(1999:2011, "-12-31", sep = ""))
cbind(y, MMWRweek(y))

Example output

            y MMWRyear MMWRweek MMWRday
1  1999-12-31     1999       52       6
2  2000-12-31     2001        1       1
3  2001-12-31     2002        1       2
4  2002-12-31     2003        1       3
5  2003-12-31     2003       53       4
6  2004-12-31     2004       52       6
7  2005-12-31     2005       52       7
8  2006-12-31     2007        1       1
9  2007-12-31     2008        1       2
10 2008-12-31     2008       53       4
11 2009-12-31     2009       52       5
12 2010-12-31     2010       52       6
13 2011-12-31     2011       52       7

MMWRweek documentation built on April 22, 2020, 5:07 p.m.