diff --git a/.Rbuildignore b/.Rbuildignore index 342923a..bc0d06d 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -7,3 +7,4 @@ ^README_files/ ^README_files/.* ^README-.* +^cran-comments\.md$ diff --git a/DESCRIPTION b/DESCRIPTION index 53be6e7..050a876 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -2,7 +2,7 @@ Package: cdcfluview Type: Package Title: Retrieve U.S. Flu Season Data from the CDC FluView Portal Version: 0.5.1 -Date: 2016-12-05 +Date: 2016-12-06 Author: Bob Rudis (bob@rud.is) Maintainer: Bob Rudis Encoding: UTF-8 @@ -25,6 +25,7 @@ Imports: utils, purrr, readr, + jsonlite, V8 Depends: R (>= 3.2.0) diff --git a/NAMESPACE b/NAMESPACE index c9b1a8d..8ae1495 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -9,6 +9,7 @@ import(dplyr) import(httr) import(utils) import(xml2) +importFrom(jsonlite,fromJSON) importFrom(purrr,discard) importFrom(purrr,keep) importFrom(purrr,map) @@ -16,3 +17,4 @@ importFrom(purrr,map_chr) importFrom(purrr,map_df) importFrom(purrr,map_lgl) importFrom(readr,read_csv) +importFrom(readr,type_convert) diff --git a/R/cdcfluview-package.R b/R/cdcfluview-package.R index 832f2ce..9506b56 100644 --- a/R/cdcfluview-package.R +++ b/R/cdcfluview-package.R @@ -10,8 +10,8 @@ #' @name cdcfluview #' @docType package #' @author Bob Rudis (bob@@rud.is) -#' @import httr xml2 dplyr utils +#' @import httr xml2 dplyr utils V8 #' @importFrom purrr map map_df map_chr map_lgl discard keep -#' @importFrom readr read_csv -#' @import V8 +#' @importFrom readr read_csv type_convert +#' @importFrom jsonlite fromJSON NULL diff --git a/R/datasets.r b/R/datasets.r index de3505d..9e73510 100644 --- a/R/datasets.r +++ b/R/datasets.r @@ -15,7 +15,7 @@ #' @keywords datasets #' @name hhs_regions #' -#' @references \url{https://www.hhs.gov/iea/regional/} +#' @references \url{https://www.hhs.gov/about/agencies/iea/regional-offices/index.html} #' @usage data(hhs_regions) #' @note Last updated 2015-08-09. #' @format A data frame with 59 rows and 4 variables diff --git a/R/get_state_data.r b/R/get_state_data.r index d3eaa42..35db31a 100644 --- a/R/get_state_data.r +++ b/R/get_state_data.r @@ -38,8 +38,8 @@ get_state_data <- function(years=as.numeric(format(Sys.Date(), "%Y"))) { res <- httr::content(tmp, as="parsed") - ctx <- v8() - ctx$eval(JS(sprintf("var dat=%s;", res))) + ctx <- V8::v8() + ctx$eval(V8::JS(sprintf("var dat=%s;", res))) res <- ctx$get("dat", flatten=FALSE) out <- suppressMessages(readr::type_convert(res$datadownload)) diff --git a/R/zzz.r b/R/zzz.r index c53ae57..2dc758c 100644 --- a/R/zzz.r +++ b/R/zzz.r @@ -2,9 +2,9 @@ if (!interactive()) return() - packageStartupMessage(paste0("cdcfluview is under *active* development. ", - "There are *breaking changes*. ", - "See https://github.com/hrbrmstr/cdcfluview for info/news.")) + # packageStartupMessage(paste0("cdcfluview is under *active* development. ", + # "There are *breaking changes*. ", + # "See https://github.com/hrbrmstr/cdcfluview for info/news.")) } diff --git a/cran-comments.md b/cran-comments.md new file mode 100644 index 0000000..587fbab --- /dev/null +++ b/cran-comments.md @@ -0,0 +1,18 @@ +## Test environments +* local OS X install, R 3.3.2 & R-devel +* ubuntu 12.04 (on travis-ci), R 3.3.2, R-oldrel and R-devel +* win-builder (devel and release) + +## R CMD check results + +0 errors | 0 warnings | 0 notes + +--- + +This is a bug-fix release. + +The CDC changed over to using https URLs which broke the core function. + +Their state API also changed from returning a CSV file to a JSON direct response. + +Tests have been added as well. \ No newline at end of file diff --git a/man/hhs_regions.Rd b/man/hhs_regions.Rd index ee31371..49d1c90 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{https://www.hhs.gov/iea/regional/} +\url{https://www.hhs.gov/about/agencies/iea/regional-offices/index.html} } \keyword{datasets}