From 8ae60beea8fbe5256abe199f7214b0a15494954b Mon Sep 17 00:00:00 2001 From: Bob Rudis Date: Mon, 5 Dec 2016 13:22:44 -0500 Subject: [PATCH] Fixed #6 --- DESCRIPTION | 4 ++-- NEWS.md | 4 ++++ R/cdcfluview-package.R | 2 +- R/datasets.r | 4 ++-- R/get_flu_data.r | 4 ++-- R/get_state_data.r | 4 ++-- R/get_weekly_flu_report.r | 6 +++--- R/mortalty.r | 6 +++--- man/cdcfluview.Rd | 4 ++-- man/census_regions.Rd | 2 +- man/get_flu_data.Rd | 2 +- man/get_mortality_surveillance_data.Rd | 2 +- man/get_state_data.Rd | 2 +- man/get_weekly_flu_report.Rd | 4 ++-- man/hhs_regions.Rd | 2 +- 15 files changed, 28 insertions(+), 24 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 7e46555..0661e08 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,8 +1,8 @@ Package: cdcfluview Type: Package Title: Retrieve U.S. Flu Season Data from the CDC FluView Portal -Version: 0.5.0 -Date: 2016-09-25 +Version: 0.5.1 +Date: 2016-12-05 Author: Bob Rudis (bob@rud.is) Maintainer: Bob Rudis Description: The U.S. Centers for Disease Control (CDC) maintains a portal diff --git a/NEWS.md b/NEWS.md index 392cb30..0de8a2f 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,7 @@ +# cscfluview 0.5.1 + +* Replaced `http` URLs with `https` as `http` ones no longer work (fixes #6) + # cdcfluview 0.5.0 * Fixed issue with WHO data format change diff --git a/R/cdcfluview-package.R b/R/cdcfluview-package.R index c1b4835..2f9a948 100644 --- a/R/cdcfluview-package.R +++ b/R/cdcfluview-package.R @@ -1,7 +1,7 @@ #' Retrieve Flu Season Data from the CDC FluView Portal #' #' The U.S. Centers for Disease Control (CDC) maintains a portal -#' \code{http://gis.cdc.gov/grasp/fluview/fluportaldashboard.html} for +#' \code{https://gis.cdc.gov/grasp/fluview/fluportaldashboard.html} for #' accessing state, regional and national influenza statistics as well as #' Mortality Surveillance Data. The Flash interface makes it difficult #' and time-consuming to select and retrieve influenza data. This package diff --git a/R/datasets.r b/R/datasets.r index 8220b63..de3505d 100644 --- a/R/datasets.r +++ b/R/datasets.r @@ -15,7 +15,7 @@ #' @keywords datasets #' @name hhs_regions #' -#' @references \url{http://www.hhs.gov/iea/regional/} +#' @references \url{https://www.hhs.gov/iea/regional/} #' @usage data(hhs_regions) #' @note Last updated 2015-08-09. #' @format A data frame with 59 rows and 4 variables @@ -35,7 +35,7 @@ NULL #' @keywords datasets #' @name census_regions #' -#' @references \url{http://www.cdc.gov/std/stats12/images/CensusMap.png} +#' @references \url{https://www.cdc.gov/std/stats12/images/CensusMap.png} #' @usage data(census_regions) #' @note Last updated 2015-08-09. #' @format A data frame with 51 rows and 2 variables diff --git a/R/get_flu_data.r b/R/get_flu_data.r index 78a1e8b..695d023 100644 --- a/R/get_flu_data.r +++ b/R/get_flu_data.r @@ -1,7 +1,7 @@ #' Retrieves state, regional or national influenza statistics from the CDC #' #' Uses the data source from the -#' \href{http://gis.cdc.gov/grasp/fluview/fluportaldashboard.html}{CDC FluView} +#' \href{https://gis.cdc.gov/grasp/fluview/fluportaldashboard.html}{CDC FluView} #' and provides flu reporting data as either a single data frame or a list of #' data frames (depending on whether either \code{WHO NREVSS} or \code{ILINet} #' (or both) is chosen. @@ -75,7 +75,7 @@ get_flu_data <- function(region="hhs", sub_region=1:10, out_file <- tempfile(fileext=".zip") - tmp <- httr::POST("http://gis.cdc.gov/grasp/fluview/FluViewPhase2CustomDownload.ashx", + tmp <- httr::POST("https://gis.cdc.gov/grasp/fluview/FluViewPhase2CustomDownload.ashx", body=params, write_disk(out_file)) diff --git a/R/get_state_data.r b/R/get_state_data.r index 8ee7156..e5de4d1 100644 --- a/R/get_state_data.r +++ b/R/get_state_data.r @@ -1,7 +1,7 @@ #' Retrieves state/territory-level influenza statistics from the CDC #' #' Uses the data source from the CDC' State-levelFluView -#' \url{http://gis.cdc.gov/grasp/fluview/main.html} and provides state flu +#' \url{https://gis.cdc.gov/grasp/fluview/main.html} and provides state flu #' reporting data as a single data frame.\cr #' \cr #' This function provides similar data to \code{\link{get_weekly_flu_report}} but @@ -39,7 +39,7 @@ get_state_data <- function(years=as.numeric(format(Sys.Date(), "%Y"))) { DataMode="STATE", SeasonsList=paste0(years, collapse=",")) - tmp <- httr::POST("http://gis.cdc.gov/grasp/fluview/FluViewPhase1CustomDownload.ashx", + tmp <- httr::POST("https://gis.cdc.gov/grasp/fluview/FluViewPhase1CustomDownload.ashx", body=params, write_disk(out_file)) diff --git a/R/get_weekly_flu_report.r b/R/get_weekly_flu_report.r index 45e0c16..3b7d4e5 100644 --- a/R/get_weekly_flu_report.r +++ b/R/get_weekly_flu_report.r @@ -1,6 +1,6 @@ #' Retrieves (high-level) weekly influenza surveillance report from the CDC #' -#' The CDC publishes a \href{http://www.cdc.gov/flu/weekly/usmap.htm}{weekly +#' The CDC publishes a \href{https://www.cdc.gov/flu/weekly/usmap.htm}{weekly #' influenza report} detailing high-level flu activity per-state. They also #' publish a data file (see \code{References}) of historical report readings. #' This function reads that XML file and produces a long \code{data_frame} @@ -9,7 +9,7 @@ #' This function provides similar data to \code{\link{get_state_data}} but without #' the reporting source metadata and a limit on the historical flu information. #' -#' @references \url{http://www.cdc.gov/flu/weekly/flureport.xml} +#' @references \url{https://www.cdc.gov/flu/weekly/flureport.xml} #' @return \code{tbl_df} (also classed with \code{cdcweeklyreport}) with six #' columns: \code{year}, \code{week_number}, \code{state}, \code{color}, #' \code{label}, \code{subtitle} @@ -20,7 +20,7 @@ get_weekly_flu_report <- function() { # grab the report - doc <- read_xml("http://www.cdc.gov/flu/weekly/flureport.xml") + doc <- read_xml("https://www.cdc.gov/flu/weekly/flureport.xml") # extract the time periods periods <- xml_attrs(xml_find_all(doc, "timeperiod")) diff --git a/R/mortalty.r b/R/mortalty.r index 160ef51..94e31aa 100644 --- a/R/mortalty.r +++ b/R/mortalty.r @@ -20,7 +20,7 @@ #' counts will be released only after 20% of the expected number of deaths are reported #' through the system. #' -#' @references \url{http://www.cdc.gov/flu/weekly/nchs.htm} +#' @references \url{https://www.cdc.gov/flu/weekly/nchs.htm} #' @return a list of \code{tbl_df}s #' @export #' @examples \dontrun{ @@ -28,9 +28,9 @@ #' } get_mortality_surveillance_data <- function() { - pg <- read_html("http://www.cdc.gov/flu/weekly/nchs.htm") + pg <- read_html("https://www.cdc.gov/flu/weekly/nchs.htm") - PREFIX <- "http://www.cdc.gov" + PREFIX <- "https://www.cdc.gov" xml_find_all(pg, ".//select[@id='State']/option[contains(@value, 'csv') and contains(@value, 'State_')]") %>% diff --git a/man/cdcfluview.Rd b/man/cdcfluview.Rd index 657f37e..1164f2d 100644 --- a/man/cdcfluview.Rd +++ b/man/cdcfluview.Rd @@ -1,5 +1,5 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/cdcfluview-package.r +% Please edit documentation in R/cdcfluview-package.R \docType{package} \name{cdcfluview} \alias{cdcfluview} @@ -7,7 +7,7 @@ \title{Retrieve Flu Season Data from the CDC FluView Portal} \description{ The U.S. Centers for Disease Control (CDC) maintains a portal -\code{http://gis.cdc.gov/grasp/fluview/fluportaldashboard.html} for +\code{https://gis.cdc.gov/grasp/fluview/fluportaldashboard.html} for accessing state, regional and national influenza statistics as well as Mortality Surveillance Data. The Flash interface makes it difficult and time-consuming to select and retrieve influenza data. This package diff --git a/man/census_regions.Rd b/man/census_regions.Rd index 6dc66c6..7b72052 100644 --- a/man/census_regions.Rd +++ b/man/census_regions.Rd @@ -22,7 +22,7 @@ This dataset contains the states belonging to the (presently) 4 Last updated 2015-08-09. } \references{ -\url{http://www.cdc.gov/std/stats12/images/CensusMap.png} +\url{https://www.cdc.gov/std/stats12/images/CensusMap.png} } \keyword{datasets} diff --git a/man/get_flu_data.Rd b/man/get_flu_data.Rd index 298a4a3..7d222cc 100644 --- a/man/get_flu_data.Rd +++ b/man/get_flu_data.Rd @@ -29,7 +29,7 @@ If only a single \code{data_source} is specified, then a single } \description{ Uses the data source from the -\href{http://gis.cdc.gov/grasp/fluview/fluportaldashboard.html}{CDC FluView} +\href{https://gis.cdc.gov/grasp/fluview/fluportaldashboard.html}{CDC FluView} and provides flu reporting data as either a single data frame or a list of data frames (depending on whether either \code{WHO NREVSS} or \code{ILINet} (or both) is chosen. diff --git a/man/get_mortality_surveillance_data.Rd b/man/get_mortality_surveillance_data.Rd index 2a8ff45..3c09933 100644 --- a/man/get_mortality_surveillance_data.Rd +++ b/man/get_mortality_surveillance_data.Rd @@ -37,6 +37,6 @@ get_mortality_surveillance_data() } } \references{ -\url{http://www.cdc.gov/flu/weekly/nchs.htm} +\url{https://www.cdc.gov/flu/weekly/nchs.htm} } diff --git a/man/get_state_data.Rd b/man/get_state_data.Rd index 2a1f459..453d244 100644 --- a/man/get_state_data.Rd +++ b/man/get_state_data.Rd @@ -17,7 +17,7 @@ A \code{data.frame} of state-level data for the specified seasons } \description{ Uses the data source from the CDC' State-levelFluView -\url{http://gis.cdc.gov/grasp/fluview/main.html} and provides state flu +\url{https://gis.cdc.gov/grasp/fluview/main.html} and provides state flu reporting data as a single data frame.\cr \cr This function provides similar data to \code{\link{get_weekly_flu_report}} but diff --git a/man/get_weekly_flu_report.Rd b/man/get_weekly_flu_report.Rd index 9188fb9..ca0afab 100644 --- a/man/get_weekly_flu_report.Rd +++ b/man/get_weekly_flu_report.Rd @@ -12,7 +12,7 @@ get_weekly_flu_report() \code{label}, \code{subtitle} } \description{ -The CDC publishes a \href{http://www.cdc.gov/flu/weekly/usmap.htm}{weekly +The CDC publishes a \href{https://www.cdc.gov/flu/weekly/usmap.htm}{weekly influenza report} detailing high-level flu activity per-state. They also publish a data file (see \code{References}) of historical report readings. This function reads that XML file and produces a long \code{data_frame} @@ -27,6 +27,6 @@ get_weekly_flu_report() } } \references{ -\url{http://www.cdc.gov/flu/weekly/flureport.xml} +\url{https://www.cdc.gov/flu/weekly/flureport.xml} } diff --git a/man/hhs_regions.Rd b/man/hhs_regions.Rd index 436d58d..ee31371 100644 --- a/man/hhs_regions.Rd +++ b/man/hhs_regions.Rd @@ -25,7 +25,7 @@ This dataset contains the names, numbers, regional offices for-, Last updated 2015-08-09. } \references{ -\url{http://www.hhs.gov/iea/regional/} +\url{https://www.hhs.gov/iea/regional/} } \keyword{datasets}