From befce81722a91d51e54abcf9fc5d9ce294c423ce Mon Sep 17 00:00:00 2001 From: Andrew Bates Date: Mon, 15 Apr 2019 11:12:47 -0700 Subject: [PATCH] rename `pi_mortality` columns regarding week to `week_*` instead of `wk_*` for consistency with `ilinet` --- DESCRIPTION | 3 ++- NEWS.md | 5 +++++ R/aaa.R | 2 +- R/pi-mortality.r | 8 ++++++++ man/pi_mortality.Rd | 2 ++ 5 files changed, 18 insertions(+), 2 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index cd4d029..7cc0b57 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -15,7 +15,8 @@ Authors@R: c( person("Sebastian", "Meyer", email = "seb.meyer@fau.de", role = "ctb", comment = c(ORCID = "0000-0002-1791-9449")), person("James", "Turtle", email = "jturtle@predsci.com", role = "ctb", - comment = c(ORCID = "0000-0003-0735-7769")) + comment = c(ORCID = "0000-0003-0735-7769")), + person("Andrew", "Bates", role = "ctb") ) Maintainer: Bob Rudis Description: The 'U.S.' Centers for Disease Control and Prevention (CDC) maintain diff --git a/NEWS.md b/NEWS.md index 6cd187b..173bd5b 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,8 @@ +#cdcfluview 0.9.1 + +- renamed `pi_mortality` columns regarding the week to `week_*` instead of `wk_*` + for consistency with `ilinet` (#21). + # cdcfluview 0.9.0 - fix bug in epiweek computation in ilinet() thanks to a bug report by @jturtle (#19) diff --git a/R/aaa.R b/R/aaa.R index 9869882..d208de9 100644 --- a/R/aaa.R +++ b/R/aaa.R @@ -1,4 +1,4 @@ -utils::globalVariables(c(".", "mmwrid", "season", "seasonid", "week_start")) +utils::globalVariables(c(".", "mmwrid", "season", "seasonid", "week_start", "wk_start", "wk_end", "year_wk_num")) # CDC U.S. region names to ID map .region_map <- c(national=3, hhs=1, census=2, state=5) diff --git a/R/pi-mortality.r b/R/pi-mortality.r index d385bc3..e748e74 100644 --- a/R/pi-mortality.r +++ b/R/pi-mortality.r @@ -37,6 +37,8 @@ #' the function is smart enough to retrieve by season ID vs convert that #' to a year. #' @note Queries for "state" and "region" are not necessarily as "instantaneous" as other API endpoints and can near or over 30s retrieval delays. +#' +#' For consistency with \code{\link{ilinet}} columns indicating the week now contain 'week' instead of the previously abbreviation 'wk'. #' @references #' - [Pneumonia and Influenza Mortality Surveillance Portal](https://gis.cdc.gov/grasp/fluview/mortality.html) #' @export @@ -144,6 +146,12 @@ pi_mortality <- function(coverage_area=c("national", "state", "region"), years=N xdf$number_pneumonia <- to_num(xdf$number_pneumonia) xdf$all_deaths <- to_num(xdf$all_deaths) xdf$Total_PnI <- to_num(xdf$Total_PnI) + xdf <- xdf %>% + dplyr::rename( + week_start = wk_start, + week_end = wk_end, + year_week_num = year_wk_num + ) xdf <- .mcga(xdf) xdf diff --git a/man/pi_mortality.Rd b/man/pi_mortality.Rd index 852b3fd..51ddbc9 100644 --- a/man/pi_mortality.Rd +++ b/man/pi_mortality.Rd @@ -48,6 +48,8 @@ calculated at the national and regional level and by age group. } \note{ Queries for "state" and "region" are not necessarily as "instantaneous" as other API endpoints and can near or over 30s retrieval delays. + +For consistency with \code{\link{ilinet}} columns indicating the week now contain 'week' instead of the previously abbreviation 'wk'. } \examples{ \dontrun{