Type: | Package |
Title: | Convert Dates to MMWR Day, Week, and Year |
Version: | 0.1.3 |
Date: | 2020-04-22 |
Author: | Jarad Niemi <niemi@iastate.edu> |
Maintainer: | Jarad Niemi <niemi@iastate.edu> |
Suggests: | testthat |
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. |
License: | GPL-2 | GPL-3 | file LICENSE [expanded from: GPL (≥ 2) | file LICENSE] |
LazyLoad: | yes |
URL: | http://wwwn.cdc.gov/nndss/document/MMWR_Week_overview.pdf |
RoxygenNote: | 7.0.1 |
NeedsCompilation: | no |
Packaged: | 2020-04-22 15:20:21 UTC; niemi |
Repository: | CRAN |
Date/Publication: | 2020-04-22 15:42:08 UTC |
MMWR day, week, and year
Description
This function returns the MMWR day, week, and year for the Date(s) provided.
Usage
MMWRweek(date)
Arguments
date |
vector which can be coerced to class |
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
Examples
y = as.Date(paste(1999:2011, "-12-31", sep = ""))
cbind(y, MMWRweek(y))
Convert MMWRweek to Date
Description
Computes the Date from the MMWR year, week, and day.
Usage
MMWRweek2Date(MMWRyear, MMWRweek, MMWRday = NULL)
Arguments
MMWRyear |
numeric vector of years |
MMWRweek |
numeric vector of weeks |
MMWRday |
numeric vector of days, defaults to a vector of 1s |
Value
Date vector of dates associated with MMWR year, week, and day
Author(s)
Jarad Niemi niemi@iastate.edu
See Also
Examples
MMWRweek2Date(MMWRyear=2015,MMWRweek=36,MMWRday=3)
Day of week according to MMWR
Description
This function returns the weekday of a given date according to MMWR.
Usage
MMWRweekday(date)
Arguments
date |
vector which can be coerced to class |
Value
vector of weekdays as a factor (first level is Sunday)
Author(s)
Sebastian Meyer seb.meyer@fau.de
See Also
Examples
y <- as.Date(paste(1999:2011, "-12-31", sep = ""))
data.frame(date = format(y), MMWRweekday = MMWRweekday(y))
Finds the start date for the year associated with date.
Description
Finds the start date for the year associated with date.
Usage
get_start_date(date)
Arguments
date |
vector which can be coerced to class |
Value
Date vector for start date of MMWR year associated with date
Author(s)
Jarad Niemi niemi@iastate.edu
See Also
Find start date for a calendar year
Description
Finds the state date given a numeric calendar year
Usage
start_date(year)
Arguments
year |
integer vector of four digit years |
Value
Date vector for January 1st of the calendar year
Author(s)
Jarad Niemi niemi@iastate.edu