Title: | Convert Dates to MMWR Day, Week, and Year |
---|---|
Description: | 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. This package provides functionality to convert Dates to MMWR day, week, and year and the reverse. |
Authors: | Jarad Niemi <[email protected]> |
Maintainer: | Jarad Niemi <[email protected]> |
License: | GPL (>= 2) | file LICENSE |
Version: | 0.1.3 |
Built: | 2025-03-09 03:10:12 UTC |
Source: | https://github.com/jarad/mmwrweek |
Finds the start date for the year associated with date.
get_start_date(date)
get_start_date(date)
date |
vector which can be coerced to class |
Date vector for start date of MMWR year associated with date
Jarad Niemi [email protected]
This function returns the MMWR day, week, and year for the Date(s) provided.
MMWRweek(date)
MMWRweek(date)
date |
vector which can be coerced to class |
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.
data.frame with elements MMWRday (of the week), MMWRweek, and MMWRyear
Jarad Niemi [email protected]
http://wwwn.cdc.gov/nndss/document/MMWR_Week_overview.pdf
y = as.Date(paste(1999:2011, "-12-31", sep = "")) cbind(y, MMWRweek(y))
y = as.Date(paste(1999:2011, "-12-31", sep = "")) cbind(y, MMWRweek(y))
Computes the Date from the MMWR year, week, and day.
MMWRweek2Date(MMWRyear, MMWRweek, MMWRday = NULL)
MMWRweek2Date(MMWRyear, MMWRweek, MMWRday = NULL)
MMWRyear |
numeric vector of years |
MMWRweek |
numeric vector of weeks |
MMWRday |
numeric vector of days, defaults to a vector of 1s |
Date vector of dates associated with MMWR year, week, and day
Jarad Niemi [email protected]
MMWRweek2Date(MMWRyear=2015,MMWRweek=36,MMWRday=3)
MMWRweek2Date(MMWRyear=2015,MMWRweek=36,MMWRday=3)
This function returns the weekday of a given date according to MMWR.
MMWRweekday(date)
MMWRweekday(date)
date |
vector which can be coerced to class |
vector of weekdays as a factor (first level is Sunday)
Sebastian Meyer [email protected]
y <- as.Date(paste(1999:2011, "-12-31", sep = "")) data.frame(date = format(y), MMWRweekday = MMWRweekday(y))
y <- as.Date(paste(1999:2011, "-12-31", sep = "")) data.frame(date = format(y), MMWRweekday = MMWRweekday(y))
Finds the state date given a numeric calendar year
start_date(year)
start_date(year)
year |
integer vector of four digit years |
Date vector for January 1st of the calendar year
Jarad Niemi [email protected]