Browse Source

README + more tests

tags/v0.7.0
boB Rudis 7 years ago
parent
commit
bfe7c62605
No known key found for this signature in database GPG Key ID: 2A514A4997464560
  1. 41
      README.Rmd
  2. BIN
      README.gfm-ascii_identifiers_files/figure-gfm/unnamed-chunk-10-1.png
  3. BIN
      README.gfm-ascii_identifiers_files/figure-gfm/unnamed-chunk-12-1.png
  4. BIN
      README.gfm-ascii_identifiers_files/figure-gfm/unnamed-chunk-5-1.png
  5. BIN
      README.gfm-ascii_identifiers_files/figure-gfm/unnamed-chunk-5-2.png
  6. BIN
      README.gfm-ascii_identifiers_files/figure-gfm/unnamed-chunk-5-3.png
  7. BIN
      README.gfm-ascii_identifiers_files/figure-gfm/unnamed-chunk-5-4.png
  8. BIN
      README.gfm-ascii_identifiers_files/figure-gfm/unnamed-chunk-5-5.png
  9. BIN
      README.gfm-ascii_identifiers_files/figure-gfm/unnamed-chunk-5-6.png
  10. BIN
      README.gfm-ascii_identifiers_files/figure-gfm/unnamed-chunk-7-1.png
  11. BIN
      README.gfm-ascii_identifiers_files/figure-gfm/unnamed-chunk-8-1.png
  12. BIN
      README.gfm-ascii_identifiers_files/figure-gfm/unnamed-chunk-8-2.png
  13. BIN
      README.gfm-ascii_identifiers_files/figure-gfm/unnamed-chunk-8-3.png
  14. BIN
      README.gfm-ascii_identifiers_files/figure-gfm/unnamed-chunk-8-4.png
  15. BIN
      README.gfm-ascii_identifiers_files/figure-gfm/unnamed-chunk-9-1.png
  16. 615
      README.md
  17. 2
      tests/testthat/test-cdcfluview.R

41
README.Rmd

@ -10,7 +10,7 @@ output: rmarkdown::github_document
# I M P O R T A N T
The CDC migrated to a new non-Flash portal and back-end APIs changed. This is a complete reimagining of the package and --- as such --- all your code is going to break. Please use GitHub issues to identify previous API functionality you would like ported over.
The CDC migrated to a new non-Flash portal and back-end APIs changed. This is a complete reimagining of the package and --- as such --- all your code is going to break...eventually. Older functions have been deprecated with warnings and will be removed at some point.
All folks providing feedback, code or suggestions will be added to the DESCRIPTION file. Please include how you would prefer to be cited in any issues you file.
@ -31,6 +31,7 @@ The following functions are implemented:
- `age_group_distribution`: Age Group Distribution of Influenza Positive Tests Reported by Public Health Laboratories
- `cdc_basemap`: Retrieve CDC U.S. Basemaps
- `geographic_spread`: State and Territorial Epidemiologists Reports of Geographic Spread of Influenza
- `get_weekly_flu_report`: Retrieves (high-level) weekly (XML) influenza surveillance report from the CDC
- `hospitalizations`: Laboratory-Confirmed Influenza Hospitalizations
- `ilinet`: Retrieve ILINet Surveillance Data
- `ili_weekly_activity_indicators`: Retrieve weekly state-level ILI indicators per-state for a given season
@ -38,10 +39,22 @@ The following functions are implemented:
- `state_data_providers`: Retrieve metadata about U.S. State CDC Provider Data
- `surveillance_areas`: Retrieve a list of valid sub-regions for each surveillance area.
- `who_nrevss`: Retrieve WHO/NREVSS Surveillance Data
MMWR ID Utilities:
- `mmwrid_map`: MMWR ID to Calendar Mappings
- `mmwr_week`: Convert a Date to an MMWR day+week+year
- `mmwr_weekday`: Convert a Date to an MMWR weekday
- `mmwr_week_to_date`: Convert an MMWR year+week or year+week+day to a Date object
Deprecated functions:
- `get_flu_data`: Retrieves state, regional or national influenza statistics from the CDC (deprecated)
- `get_hosp_data`: Retrieves influenza hospitalization statistics from the CDC (deprecated)
- `get_mortality_surveillance_data`: Mortality Surveillance Data from the National Center for Health Statistics (deprecated)
- `get_state_data`: Retrieves state/territory-level influenza statistics from the CDC (deprecated)
The following data sets are included:
- `hhs_regions`: HHS Region Table (a data frame with 59 rows and 4 variables)
@ -72,7 +85,7 @@ packageVersion("cdcfluview")
### Age Group Distribution of Influenza Positive Tests Reported by Public Health Laboratories
```{r message=FALSE, warning=FALSE}
glimpse(age_group_distribution())
glimpse(age_group_distribution(years=2015))
```
### Retrieve CDC U.S. Coverage Map
@ -107,13 +120,13 @@ ggplot(fs_nat, aes(wk_end, rate)) +
title="FluSurv-NET :: Entire Network :: All Seasons :: Cumulative Rate") +
theme_ipsum_rc()
glimpse(hospitalizations("eip"))
glimpse(hospitalizations("eip", years=2015))
glimpse(hospitalizations("eip", "Colorado"))
glimpse(hospitalizations("eip", "Colorado", years=2015))
glimpse(hospitalizations("ihsp"))
glimpse(hospitalizations("ihsp", years=2015))
glimpse(hospitalizations("ihsp", "Oklahoma"))
glimpse(hospitalizations("ihsp", "Oklahoma", years=2015))
```
### Retrieve ILINet Surveillance Data
@ -144,9 +157,9 @@ ili_weekly_activity_indicators(2017)
xdf <- map_df(2008:2017, ili_weekly_activity_indicators)
count(xdf, weekend, ili_activity_label) %>%
complete(weekend, ili_activity_label) %>%
ggplot(aes(weekend, ili_activity_label, fill=n)) +
count(xdf, weekend, activity_level_label) %>%
complete(weekend, activity_level_label) %>%
ggplot(aes(weekend, activity_level_label, fill=n)) +
geom_tile(color="#c2c2c2", size=0.1) +
scale_x_date(expand=c(0,0)) +
viridis::scale_fill_viridis(name="# States", na.value="White") +
@ -172,9 +185,9 @@ select(nat_pi, wk_end, percent_pni, baseline, threshold) %>%
theme_ipsum_rc(grid="XY") +
theme(legend.position="bottom")
(st_pi <- pi_mortality("state"))
(st_pi <- pi_mortality("state", years=2015))
(reg_pi <- pi_mortality("region"))
(reg_pi <- pi_mortality("region", years=2015))
```
### Retrieve metadata about U.S. State CDC Provider Data
@ -196,11 +209,11 @@ mutate(xdat$combined_prior_to_2015_16,
labs(x=NULL, title="WHO/NREVSS Surveillance Data (National)") +
theme_ipsum_rc(grid="XY")
who_nrevss("hhs")
who_nrevss("hhs", years=2016)
who_nrevss("census")
who_nrevss("census", years=2016)
who_nrevss("state")
who_nrevss("state", years=2016)
```

BIN
README.gfm-ascii_identifiers_files/figure-gfm/unnamed-chunk-10-1.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 74 KiB

BIN
README.gfm-ascii_identifiers_files/figure-gfm/unnamed-chunk-12-1.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

BIN
README.gfm-ascii_identifiers_files/figure-gfm/unnamed-chunk-5-1.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 59 KiB

BIN
README.gfm-ascii_identifiers_files/figure-gfm/unnamed-chunk-5-2.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 97 KiB

BIN
README.gfm-ascii_identifiers_files/figure-gfm/unnamed-chunk-5-3.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 KiB

BIN
README.gfm-ascii_identifiers_files/figure-gfm/unnamed-chunk-5-4.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 123 KiB

BIN
README.gfm-ascii_identifiers_files/figure-gfm/unnamed-chunk-5-5.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 109 KiB

BIN
README.gfm-ascii_identifiers_files/figure-gfm/unnamed-chunk-5-6.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 121 KiB

BIN
README.gfm-ascii_identifiers_files/figure-gfm/unnamed-chunk-7-1.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 100 KiB

BIN
README.gfm-ascii_identifiers_files/figure-gfm/unnamed-chunk-8-1.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

BIN
README.gfm-ascii_identifiers_files/figure-gfm/unnamed-chunk-8-2.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 114 KiB

BIN
README.gfm-ascii_identifiers_files/figure-gfm/unnamed-chunk-8-3.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 120 KiB

BIN
README.gfm-ascii_identifiers_files/figure-gfm/unnamed-chunk-8-4.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 163 KiB

BIN
README.gfm-ascii_identifiers_files/figure-gfm/unnamed-chunk-9-1.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

615
README.md

@ -5,13 +5,12 @@ Status](https://travis-ci.org/hrbrmstr/cdcfluview.svg?branch=master)](https://tr
[![Coverage
Status](https://img.shields.io/codecov/c/github/hrbrmstr/cdcfluview/master.svg)](https://codecov.io/github/hrbrmstr/cdcfluview?branch=master)
I M P O R T A N T
=================
# I M P O R T A N T
The CDC migrated to a new non-Flash portal and back-end APIs changed.
This is a complete reimagining of the package and — as such — all your
code is going to break. Please use GitHub issues to identify previous
API functionality you would like ported over.
code is going to break…eventually. Older functions have been deprecated
with warnings and will be removed at some point.
All folks providing feedback, code or suggestions will be added to the
DESCRIPTION file. Please include how you would prefer to be cited in any
@ -22,13 +21,11 @@ If there’s a particular data set from
and that isn’t in the package, please file it as an issue and be as
specific as you can (screen shot if possible).
:mask: cdcfluview
=================
# :mask: cdcfluview
Retrieve U.S. Flu Season Data from the CDC FluView Portal
Description
-----------
## Description
The U.S. Centers for Disease Control (CDC) maintains a portal
<http://gis.cdc.gov/grasp/fluview/fluportaldashboard.html> for accessing
@ -38,49 +35,63 @@ time-consuming to select and retrieve influenza data. This package
provides functions to access the data provided by the portal’s
underlying API.
What’s Inside The Tin
---------------------
## What’s Inside The Tin
The following functions are implemented:
- `age_group_distribution`: Age Group Distribution of Influenza
- `age_group_distribution`: Age Group Distribution of Influenza
Positive Tests Reported by Public Health Laboratories
- `cdc_basemap`: Retrieve CDC U.S. Basemaps
- `geographic_spread`: State and Territorial Epidemiologists Reports
- `cdc_basemap`: Retrieve CDC U.S. Basemaps
- `geographic_spread`: State and Territorial Epidemiologists Reports
of Geographic Spread of Influenza
- `hospitalizations`: Laboratory-Confirmed Influenza Hospitalizations
- `ilinet`: Retrieve ILINet Surveillance Data
- `ili_weekly_activity_indicators`: Retrieve weekly state-level ILI
- `get_weekly_flu_report`: Retrieves (high-level) weekly (XML)
influenza surveillance report from the CDC
- `hospitalizations`: Laboratory-Confirmed Influenza Hospitalizations
- `ilinet`: Retrieve ILINet Surveillance Data
- `ili_weekly_activity_indicators`: Retrieve weekly state-level ILI
indicators per-state for a given season
- `pi_mortality`: Pneumonia and Influenza Mortality Surveillance
- `state_data_providers`: Retrieve metadata about U.S. State CDC
- `pi_mortality`: Pneumonia and Influenza Mortality Surveillance
- `state_data_providers`: Retrieve metadata about U.S. State CDC
Provider Data
- `surveillance_areas`: Retrieve a list of valid sub-regions for each
- `surveillance_areas`: Retrieve a list of valid sub-regions for each
surveillance area.
- `who_nrevss`: Retrieve WHO/NREVSS Surveillance Data
- `mmwr_week`: Convert a Date to an MMWR day+week+year
- `mmwr_weekday`: Convert a Date to an MMWR weekday
- `mmwr_week_to_date`: Convert an MMWR year+week or year+week+day to a
- `who_nrevss`: Retrieve WHO/NREVSS Surveillance Data
MMWR ID Utilities:
- `mmwrid_map`: MMWR ID to Calendar Mappings
- `mmwr_week`: Convert a Date to an MMWR day+week+year
- `mmwr_weekday`: Convert a Date to an MMWR weekday
- `mmwr_week_to_date`: Convert an MMWR year+week or year+week+day to a
Date object
Deprecated functions:
- `get_flu_data`: Retrieves state, regional or national influenza
statistics from the CDC (deprecated)
- `get_hosp_data`: Retrieves influenza hospitalization statistics from
the CDC (deprecated)
- `get_mortality_surveillance_data`: Mortality Surveillance Data from
the National Center for Health Statistics (deprecated)
- `get_state_data`: Retrieves state/territory-level influenza
statistics from the CDC (deprecated)
The following data sets are included:
- `hhs_regions`: HHS Region Table (a data frame with 59 rows and 4
- `hhs_regions`: HHS Region Table (a data frame with 59 rows and 4
variables)
- `census_regions`: Census Region Table (a data frame with 51 rows and
- `census_regions`: Census Region Table (a data frame with 51 rows and
2 variables)
- `mmwrid_map`: MMWR ID to Calendar Mappings (it is exported &
- `mmwrid_map`: MMWR ID to Calendar Mappings (it is exported &
available, no need to use `data()`)
Installation
------------
## Installation
``` r
devtools::install_github("hrbrmstr/cdcfluview")
```
Usage
-----
## Usage
``` r
library(cdcfluview)
@ -96,27 +107,27 @@ packageVersion("cdcfluview")
### Age Group Distribution of Influenza Positive Tests Reported by Public Health Laboratories
``` r
glimpse(age_group_distribution())
glimpse(age_group_distribution(years=2015))
```
## Observations: 36,144
## Observations: 1,872
## Variables: 16
## $ sea_label <chr> "1997-98", "1997-98", "1997-98", "1997-98", "1997-98", "1997-98", "1997-98", "1997-98", "...
## $ sea_label <chr> "2015-16", "2015-16", "2015-16", "2015-16", "2015-16", "2015-16", "2015-16", "2015-16", "...
## $ age_label <fctr> 0-4 yr, 0-4 yr, 0-4 yr, 0-4 yr, 0-4 yr, 0-4 yr, 0-4 yr, 0-4 yr, 0-4 yr, 0-4 yr, 0-4 yr, ...
## $ vir_label <fctr> A (Subtyping not Performed), A (Subtyping not Performed), A (Subtyping not Performed), A...
## $ count <int> 0, 1, 0, 0, 0, 0, 0, 3, 0, 6, 0, 1, 1, 2, 11, 8, 18, 26, 22, 19, 2, 5, 2, 1, 4, 0, 0, 0, ...
## $ mmwrid <int> 1866, 1867, 1868, 1869, 1870, 1871, 1872, 1873, 1874, 1875, 1876, 1877, 1878, 1879, 1880,...
## $ seasonid <int> 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 3...
## $ publishyearweekid <int> 2913, 2913, 2913, 2913, 2913, 2913, 2913, 2913, 2913, 2913, 2913, 2913, 2913, 2913, 2913,...
## $ sea_description <chr> "Season 1997-98", "Season 1997-98", "Season 1997-98", "Season 1997-98", "Season 1997-98",...
## $ sea_startweek <int> 1866, 1866, 1866, 1866, 1866, 1866, 1866, 1866, 1866, 1866, 1866, 1866, 1866, 1866, 1866,...
## $ sea_endweek <int> 1918, 1918, 1918, 1918, 1918, 1918, 1918, 1918, 1918, 1918, 1918, 1918, 1918, 1918, 1918,...
## $ count <int> 0, 1, 0, 1, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 3, 2, 2, 3, 3, 3, 0, 0, 2, 0, 1, 1, 0,...
## $ mmwrid <int> 2806, 2807, 2808, 2809, 2810, 2811, 2812, 2813, 2814, 2815, 2816, 2817, 2818, 2819, 2820,...
## $ seasonid <int> 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 5...
## $ publishyearweekid <int> 2914, 2914, 2914, 2914, 2914, 2914, 2914, 2914, 2914, 2914, 2914, 2914, 2914, 2914, 2914,...
## $ sea_description <chr> "Season 2015-16", "Season 2015-16", "Season 2015-16", "Season 2015-16", "Season 2015-16",...
## $ sea_startweek <int> 2806, 2806, 2806, 2806, 2806, 2806, 2806, 2806, 2806, 2806, 2806, 2806, 2806, 2806, 2806,...
## $ sea_endweek <int> 2857, 2857, 2857, 2857, 2857, 2857, 2857, 2857, 2857, 2857, 2857, 2857, 2857, 2857, 2857,...
## $ vir_description <chr> "A-Unk", "A-Unk", "A-Unk", "A-Unk", "A-Unk", "A-Unk", "A-Unk", "A-Unk", "A-Unk", "A-Unk",...
## $ vir_startmmwrid <int> 1397, 1397, 1397, 1397, 1397, 1397, 1397, 1397, 1397, 1397, 1397, 1397, 1397, 1397, 1397,...
## $ vir_endmmwrid <int> 3131, 3131, 3131, 3131, 3131, 3131, 3131, 3131, 3131, 3131, 3131, 3131, 3131, 3131, 3131,...
## $ wk_start <date> 1997-09-28, 1997-10-05, 1997-10-12, 1997-10-19, 1997-10-26, 1997-11-02, 1997-11-09, 1997...
## $ wk_end <date> 1997-10-04, 1997-10-11, 1997-10-18, 1997-10-25, 1997-11-01, 1997-11-08, 1997-11-15, 1997...
## $ year_wk_num <int> 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11...
## $ wk_start <date> 2015-10-04, 2015-10-11, 2015-10-18, 2015-10-25, 2015-11-01, 2015-11-08, 2015-11-15, 2015...
## $ wk_end <date> 2015-10-10, 2015-10-17, 2015-10-24, 2015-10-31, 2015-11-07, 2015-11-14, 2015-11-21, 2015...
## $ year_wk_num <int> 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12...
### Retrieve CDC U.S. Coverage Map
@ -124,37 +135,37 @@ glimpse(age_group_distribution())
plot(cdc_basemap("national"))
```
![](README_files/figure-markdown_github-ascii_identifiers/unnamed-chunk-5-1.png)
![](README.gfm-ascii_identifiers_files/figure-gfm/unnamed-chunk-5-1.png)<!-- -->
``` r
plot(cdc_basemap("hhs"))
```
![](README_files/figure-markdown_github-ascii_identifiers/unnamed-chunk-5-2.png)
![](README.gfm-ascii_identifiers_files/figure-gfm/unnamed-chunk-5-2.png)<!-- -->
``` r
plot(cdc_basemap("census"))
```
![](README_files/figure-markdown_github-ascii_identifiers/unnamed-chunk-5-3.png)
![](README.gfm-ascii_identifiers_files/figure-gfm/unnamed-chunk-5-3.png)<!-- -->
``` r
plot(cdc_basemap("states"))
```
![](README_files/figure-markdown_github-ascii_identifiers/unnamed-chunk-5-4.png)
![](README.gfm-ascii_identifiers_files/figure-gfm/unnamed-chunk-5-4.png)<!-- -->
``` r
plot(cdc_basemap("spread"))
```
![](README_files/figure-markdown_github-ascii_identifiers/unnamed-chunk-5-5.png)
![](README.gfm-ascii_identifiers_files/figure-gfm/unnamed-chunk-5-5.png)<!-- -->
``` r
plot(cdc_basemap("surv"))
```
![](README_files/figure-markdown_github-ascii_identifiers/unnamed-chunk-5-6.png)
![](README.gfm-ascii_identifiers_files/figure-gfm/unnamed-chunk-5-6.png)<!-- -->
### State and Territorial Epidemiologists Reports of Geographic Spread of Influenza
@ -162,7 +173,7 @@ plot(cdc_basemap("surv"))
glimpse(geographic_spread())
```
## Observations: 25,795
## Observations: 25,848
## Variables: 7
## $ statename <chr> "Alabama", "Alabama", "Alabama", "Alabama", "Alabama", "Alabama", "Alabama", "Alabama", "...
## $ url <chr> "http://adph.org/influenza/", "http://adph.org/influenza/", "http://adph.org/influenza/",...
@ -233,91 +244,91 @@ ggplot(fs_nat, aes(wk_end, rate)) +
theme_ipsum_rc()
```
![](README_files/figure-markdown_github-ascii_identifiers/unnamed-chunk-7-1.png)
![](README.gfm-ascii_identifiers_files/figure-gfm/unnamed-chunk-7-1.png)<!-- -->
``` r
glimpse(hospitalizations("eip"))
glimpse(hospitalizations("eip", years=2015))
```
## Observations: 2,385
## Observations: 180
## Variables: 14
## $ surveillance_area <chr> "EIP", "EIP", "EIP", "EIP", "EIP", "EIP", "EIP", "EIP", "EIP", "EIP", "EIP", "EIP", "EIP"...
## $ region <chr> "Entire Network", "Entire Network", "Entire Network", "Entire Network", "Entire Network",...
## $ year <int> 2003, 2003, 2003, 2003, 2003, 2003, 2003, 2003, 2003, 2003, 2003, 2003, 2003, 2003, 2004,...
## $ season <int> 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 4...
## $ wk_start <date> 2003-09-28, 2003-10-05, 2003-10-12, 2003-10-19, 2003-10-26, 2003-11-02, 2003-11-09, 2003...
## $ wk_end <date> 2003-10-04, 2003-10-11, 2003-10-18, 2003-10-25, 2003-11-01, 2003-11-08, 2003-11-15, 2003...
## $ year_wk_num <int> 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11...
## $ rate <dbl> 0.0, 0.0, 0.0, 0.0, 0.1, 0.7, 3.3, 9.1, 16.9, 28.1, 40.0, 55.6, 69.0, 78.7, 83.1, 86.6, 8...
## $ weeklyrate <dbl> 0.0, 0.0, 0.0, 0.0, 0.1, 0.6, 2.7, 5.8, 7.8, 11.2, 11.9, 15.6, 13.4, 9.7, 4.4, 3.4, 1.3, ...
## $ year <int> 2015, 2015, 2015, 2015, 2015, 2015, 2015, 2015, 2015, 2015, 2015, 2015, 2015, 2016, 2016,...
## $ season <int> 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 5...
## $ wk_start <date> 2015-10-04, 2015-10-11, 2015-10-18, 2015-10-25, 2015-11-01, 2015-11-08, 2015-11-15, 2015...
## $ wk_end <date> 2015-10-10, 2015-10-17, 2015-10-24, 2015-10-31, 2015-11-07, 2015-11-14, 2015-11-21, 2015...
## $ year_wk_num <int> 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12...
## $ rate <dbl> 0.1, 0.3, 0.4, 0.5, 0.8, 0.8, 1.1, 1.4, 1.6, 1.7, 1.8, 2.1, 2.4, 2.9, 3.2, 3.5, 4.2, 5.3,...
## $ weeklyrate <dbl> 0.1, 0.3, 0.1, 0.1, 0.3, 0.0, 0.3, 0.3, 0.2, 0.1, 0.1, 0.3, 0.3, 0.5, 0.3, 0.3, 0.6, 1.2,...
## $ age <int> 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,...
## $ age_label <fctr> 0-4 yr, 0-4 yr, 0-4 yr, 0-4 yr, 0-4 yr, 0-4 yr, 0-4 yr, 0-4 yr, 0-4 yr, 0-4 yr, 0-4 yr, ...
## $ sea_label <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, N...
## $ sea_description <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, N...
## $ mmwrid <int> 2179, 2180, 2181, 2182, 2183, 2184, 2185, 2186, 2187, 2188, 2189, 2190, 2191, 2192, 2193,...
## $ sea_label <chr> "2015-16", "2015-16", "2015-16", "2015-16", "2015-16", "2015-16", "2015-16", "2015-16", "...
## $ sea_description <chr> "Season 2015-16", "Season 2015-16", "Season 2015-16", "Season 2015-16", "Season 2015-16",...
## $ mmwrid <int> 2806, 2807, 2808, 2809, 2810, 2811, 2812, 2813, 2814, 2815, 2816, 2817, 2818, 2819, 2820,...
``` r
glimpse(hospitalizations("eip", "Colorado"))
glimpse(hospitalizations("eip", "Colorado", years=2015))
```
## Observations: 2,385
## Observations: 180
## Variables: 14
## $ surveillance_area <chr> "EIP", "EIP", "EIP", "EIP", "EIP", "EIP", "EIP", "EIP", "EIP", "EIP", "EIP", "EIP", "EIP"...
## $ region <chr> "Colorado", "Colorado", "Colorado", "Colorado", "Colorado", "Colorado", "Colorado", "Colo...
## $ year <int> 2003, 2003, 2003, 2003, 2003, 2003, 2003, 2003, 2003, 2003, 2003, 2003, 2003, 2003, 2004,...
## $ season <int> 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 4...
## $ wk_start <date> 2003-09-28, 2003-10-05, 2003-10-12, 2003-10-19, 2003-10-26, 2003-11-02, 2003-11-09, 2003...
## $ wk_end <date> 2003-10-04, 2003-10-11, 2003-10-18, 2003-10-25, 2003-11-01, 2003-11-08, 2003-11-15, 2003...
## $ year_wk_num <int> 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11...
## $ rate <dbl> 0.0, 0.0, 0.0, 0.0, 0.6, 3.6, 21.2, 57.5, 94.3, 130.6, 146.4, 150.6, 153.0, 157.2, 158.5,...
## $ weeklyrate <dbl> 0.0, 0.0, 0.0, 0.0, 0.6, 3.0, 17.5, 36.3, 36.9, 36.3, 15.7, 4.2, 2.4, 4.2, 1.2, 1.2, 1.8,...
## $ year <int> 2015, 2015, 2015, 2015, 2015, 2015, 2015, 2015, 2015, 2015, 2015, 2015, 2015, 2016, 2016,...
## $ season <int> 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 5...
## $ wk_start <date> 2015-10-04, 2015-10-11, 2015-10-18, 2015-10-25, 2015-11-01, 2015-11-08, 2015-11-15, 2015...
## $ wk_end <date> 2015-10-10, 2015-10-17, 2015-10-24, 2015-10-31, 2015-11-07, 2015-11-14, 2015-11-21, 2015...
## $ year_wk_num <int> 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12...
## $ rate <dbl> 0.0, 0.0, 0.6, 0.6, 0.6, 0.6, 1.2, 1.7, 1.7, 1.7, 1.7, 1.7, 2.9, 3.5, 3.5, 3.5, 4.1, 6.4,...
## $ weeklyrate <dbl> 0.0, 0.0, 0.6, 0.0, 0.0, 0.0, 0.6, 0.6, 0.0, 0.0, 0.0, 0.0, 1.2, 0.6, 0.0, 0.0, 0.6, 2.3,...
## $ age <int> 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,...
## $ age_label <fctr> 0-4 yr, 0-4 yr, 0-4 yr, 0-4 yr, 0-4 yr, 0-4 yr, 0-4 yr, 0-4 yr, 0-4 yr, 0-4 yr, 0-4 yr, ...
## $ sea_label <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, N...
## $ sea_description <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, N...
## $ mmwrid <int> 2179, 2180, 2181, 2182, 2183, 2184, 2185, 2186, 2187, 2188, 2189, 2190, 2191, 2192, 2193,...
## $ sea_label <chr> "2015-16", "2015-16", "2015-16", "2015-16", "2015-16", "2015-16", "2015-16", "2015-16", "...
## $ sea_description <chr> "Season 2015-16", "Season 2015-16", "Season 2015-16", "Season 2015-16", "Season 2015-16",...
## $ mmwrid <int> 2806, 2807, 2808, 2809, 2810, 2811, 2812, 2813, 2814, 2815, 2816, 2817, 2818, 2819, 2820,...
``` r
glimpse(hospitalizations("ihsp"))
glimpse(hospitalizations("ihsp", years=2015))
```
## Observations: 1,476
## Observations: 180
## Variables: 14
## $ surveillance_area <chr> "IHSP", "IHSP", "IHSP", "IHSP", "IHSP", "IHSP", "IHSP", "IHSP", "IHSP", "IHSP", "IHSP", "...
## $ region <chr> "Entire Network", "Entire Network", "Entire Network", "Entire Network", "Entire Network",...
## $ year <int> 2009, 2009, 2009, 2009, 2009, 2009, 2009, 2009, 2009, 2009, 2009, 2009, 2009, 2009, 2009,...
## $ season <int> 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 4...
## $ wk_start <date> 2009-08-30, 2009-09-06, 2009-09-13, 2009-09-20, 2009-09-27, 2009-10-04, 2009-10-11, 2009...
## $ wk_end <date> 2009-09-05, 2009-09-12, 2009-09-19, 2009-09-26, 2009-10-03, 2009-10-10, 2009-10-17, 2009...
## $ year_wk_num <int> 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 1, 2, 3, 4, 5, 6,...
## $ rate <dbl> 0.0, 0.4, 3.6, 7.6, 14.0, 25.5, 47.1, 71.8, 87.4, 92.5, 94.9, 96.9, 98.1, 98.9, 100.9, 10...
## $ weeklyrate <dbl> 0.0, 0.4, 3.2, 4.0, 6.4, 11.6, 21.5, 24.7, 15.6, 5.2, 2.4, 2.0, 1.2, 0.8, 2.0, 1.2, 1.6, ...
## $ year <int> 2015, 2015, 2015, 2015, 2015, 2015, 2015, 2015, 2015, 2015, 2015, 2015, 2015, 2016, 2016,...
## $ season <int> 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 5...
## $ wk_start <date> 2015-10-04, 2015-10-11, 2015-10-18, 2015-10-25, 2015-11-01, 2015-11-08, 2015-11-15, 2015...
## $ wk_end <date> 2015-10-10, 2015-10-17, 2015-10-24, 2015-10-31, 2015-11-07, 2015-11-14, 2015-11-21, 2015...
## $ year_wk_num <int> 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12...
## $ rate <dbl> 0.0, 0.0, 0.4, 0.4, 0.4, 1.1, 1.1, 1.1, 1.1, 1.5, 1.8, 2.2, 2.2, 2.5, 2.5, 2.5, 2.9, 4.0,...
## $ weeklyrate <dbl> 0.0, 0.0, 0.4, 0.0, 0.0, 0.7, 0.0, 0.0, 0.0, 0.4, 0.4, 0.4, 0.0, 0.4, 0.0, 0.0, 0.4, 1.1,...
## $ age <int> 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,...
## $ age_label <fctr> 0-4 yr, 0-4 yr, 0-4 yr, 0-4 yr, 0-4 yr, 0-4 yr, 0-4 yr, 0-4 yr, 0-4 yr, 0-4 yr, 0-4 yr, ...
## $ sea_label <chr> "2009-10", "2009-10", "2009-10", "2009-10", "2009-10", "2009-10", "2009-10", "2009-10", "...
## $ sea_description <chr> "Season 2009-10", "Season 2009-10", "Season 2009-10", "Season 2009-10", "Season 2009-10",...
## $ mmwrid <int> 2488, 2489, 2490, 2491, 2492, 2493, 2494, 2495, 2496, 2497, 2498, 2499, 2500, 2501, 2502,...
## $ sea_label <chr> "2015-16", "2015-16", "2015-16", "2015-16", "2015-16", "2015-16", "2015-16", "2015-16", "...
## $ sea_description <chr> "Season 2015-16", "Season 2015-16", "Season 2015-16", "Season 2015-16", "Season 2015-16",...
## $ mmwrid <int> 2806, 2807, 2808, 2809, 2810, 2811, 2812, 2813, 2814, 2815, 2816, 2817, 2818, 2819, 2820,...
``` r
glimpse(hospitalizations("ihsp", "Oklahoma"))
glimpse(hospitalizations("ihsp", "Oklahoma", years=2015))
```
## Observations: 390
## Observations: 180
## Variables: 14
## $ surveillance_area <chr> "IHSP", "IHSP", "IHSP", "IHSP", "IHSP", "IHSP", "IHSP", "IHSP", "IHSP", "IHSP", "IHSP", "...
## $ region <chr> "Oklahoma", "Oklahoma", "Oklahoma", "Oklahoma", "Oklahoma", "Oklahoma", "Oklahoma", "Okla...
## $ year <int> 2009, 2009, 2009, 2009, 2009, 2009, 2009, 2009, 2009, 2009, 2009, 2009, 2009, 2009, 2009,...
## $ season <int> 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 4...
## $ wk_start <date> 2009-08-30, 2009-09-06, 2009-09-13, 2009-09-20, 2009-09-27, 2009-10-04, 2009-10-11, 2009...
## $ wk_end <date> 2009-09-05, 2009-09-12, 2009-09-19, 2009-09-26, 2009-10-03, 2009-10-10, 2009-10-17, 2009...
## $ year_wk_num <int> 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 1, 2, 3, 4, 5, 6,...
## $ rate <dbl> 0.0, 1.3, 10.8, 21.5, 40.4, 63.3, 88.9, 106.4, 115.8, 121.2, 125.2, 125.2, 126.6, 127.9, ...
## $ weeklyrate <dbl> 0.0, 1.3, 9.4, 10.8, 18.9, 22.9, 25.6, 17.5, 9.4, 5.4, 4.0, 0.0, 1.3, 1.3, 2.7, 1.3, 5.4,...
## $ year <int> 2010, 2010, 2010, 2010, 2010, 2010, 2010, 2010, 2010, 2010, 2010, 2010, 2010, 2011, 2011,...
## $ season <int> 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 5...
## $ wk_start <date> 2010-10-03, 2010-10-10, 2010-10-17, 2010-10-24, 2010-10-31, 2010-11-07, 2010-11-14, 2010...
## $ wk_end <date> 2010-10-09, 2010-10-16, 2010-10-23, 2010-10-30, 2010-11-06, 2010-11-13, 2010-11-20, 2010...
## $ year_wk_num <int> 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12...
## $ rate <dbl> 0.0, 0.0, 1.3, 1.3, 1.3, 1.3, 1.3, 1.3, 1.3, 2.6, 2.6, 6.6, 15.9, 18.5, 35.7, 54.2, 83.3,...
## $ weeklyrate <dbl> 0.0, 0.0, 1.3, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.3, 0.0, 4.0, 9.3, 2.6, 17.2, 18.5, 29.1, 2...
## $ age <int> 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,...
## $ age_label <fctr> 0-4 yr, 0-4 yr, 0-4 yr, 0-4 yr, 0-4 yr, 0-4 yr, 0-4 yr, 0-4 yr, 0-4 yr, 0-4 yr, 0-4 yr, ...
## $ sea_label <chr> "2009-10", "2009-10", "2009-10", "2009-10", "2009-10", "2009-10", "2009-10", "2009-10", "...
## $ sea_description <chr> "Season 2009-10", "Season 2009-10", "Season 2009-10", "Season 2009-10", "Season 2009-10",...
## $ mmwrid <int> 2488, 2489, 2490, 2491, 2492, 2493, 2494, 2495, 2496, 2497, 2498, 2499, 2500, 2501, 2502,...
## $ sea_label <chr> "2010-11", "2010-11", "2010-11", "2010-11", "2010-11", "2010-11", "2010-11", "2010-11", "...
## $ sea_description <chr> "Season 2010-11", "Season 2010-11", "Season 2010-11", "Season 2010-11", "Season 2010-11",...
## $ mmwrid <int> 2545, 2546, 2547, 2548, 2549, 2550, 2551, 2552, 2553, 2554, 2555, 2556, 2557, 2558, 2559,...
### Retrieve ILINet Surveillance Data
@ -340,7 +351,7 @@ walk(c("national", "hhs", "census", "state"), ~{
})
```
## Observations: 1,048
## Observations: 1,049
## Variables: 16
## $ region_type <chr> "National", "National", "National", "National", "National", "National", "National", "Natio...
## $ region <chr> "National", "National", "National", "National", "National", "National", "National", "Natio...
@ -358,7 +369,7 @@ walk(c("national", "hhs", "census", "state"), ~{
## $ num_of_providers <dbl> 192, 191, 219, 213, 213, 195, 248, 256, 252, 253, 242, 190, 251, 250, 254, 255, 245, 245, ...
## $ total_patients <dbl> 46842, 48023, 54961, 57044, 55506, 51062, 64463, 66749, 52890, 67887, 61314, 47719, 48429,...
## $ week_start <date> 1997-10-06, 1997-10-13, 1997-10-20, 1997-10-27, 1997-11-03, 1997-11-10, 1997-11-17, 1997-...
## # A tibble: 1,048 x 16
## # A tibble: 1,049 x 16
## region_type region year week weighted_ili unweighted_ili age_0_4 age_25_49 age_25_64 age_5_24 age_50_64 age_65
## <chr> <chr> <int> <int> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 National National 1997 40 1.10148 1.21686 179 NA 157 205 NA 29
@ -371,12 +382,12 @@ walk(c("national", "hhs", "census", "state"), ~{
## 8 National National 1997 47 2.44749 1.64796 288 NA 293 456 NA 63
## 9 National National 1997 48 1.73901 1.67517 268 NA 206 343 NA 69
## 10 National National 1997 49 1.93919 1.61739 299 NA 282 415 NA 102
## # ... with 1,038 more rows, and 4 more variables: ilitotal <dbl>, num_of_providers <dbl>, total_patients <dbl>,
## # ... with 1,039 more rows, and 4 more variables: ilitotal <dbl>, num_of_providers <dbl>, total_patients <dbl>,
## # week_start <date>
![](README_files/figure-markdown_github-ascii_identifiers/unnamed-chunk-8-1.png)
![](README.gfm-ascii_identifiers_files/figure-gfm/unnamed-chunk-8-1.png)<!-- -->
## Observations: 10,480
## Observations: 10,490
## Variables: 16
## $ region_type <chr> "HHS Regions", "HHS Regions", "HHS Regions", "HHS Regions", "HHS Regions", "HHS Regions", ...
## $ region <fctr> Region 1, Region 2, Region 3, Region 4, Region 5, Region 6, Region 7, Region 8, Region 9,...
@ -394,7 +405,7 @@ walk(c("national", "hhs", "census", "state"), ~{
## $ num_of_providers <dbl> 32, 7, 16, 29, 49, 4, 14, 5, 23, 13, 29, 7, 17, 31, 48, 4, 14, 6, 23, 12, 40, 7, 15, 33, 6...
## $ total_patients <dbl> 7053, 780, 2385, 10222, 9875, 669, 2342, 1183, 10758, 1575, 6987, 872, 2740, 11310, 9618, ...
## $ week_start <date> 1997-10-06, 1997-10-06, 1997-10-06, 1997-10-06, 1997-10-06, 1997-10-06, 1997-10-06, 1997-...
## # A tibble: 10,480 x 16
## # A tibble: 10,490 x 16
## region_type region year week weighted_ili unweighted_ili age_0_4 age_25_49 age_25_64 age_5_24 age_50_64 age_65
## <chr> <fctr> <int> <int> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 HHS Regions Region 1 1997 40 0.498535 0.623848 15 NA 7 22 NA 0
@ -407,12 +418,12 @@ walk(c("national", "hhs", "census", "state"), ~{
## 8 HHS Regions Region 8 1997 40 0.516017 0.422654 2 NA 0 3 NA 0
## 9 HHS Regions Region 9 1997 40 1.807610 2.258780 80 NA 76 74 NA 13
## 10 HHS Regions Region 10 1997 40 4.743520 4.825400 31 NA 12 30 NA 3
## # ... with 10,470 more rows, and 4 more variables: ilitotal <dbl>, num_of_providers <dbl>, total_patients <dbl>,
## # ... with 10,480 more rows, and 4 more variables: ilitotal <dbl>, num_of_providers <dbl>, total_patients <dbl>,
## # week_start <date>
![](README_files/figure-markdown_github-ascii_identifiers/unnamed-chunk-8-2.png)
![](README.gfm-ascii_identifiers_files/figure-gfm/unnamed-chunk-8-2.png)<!-- -->
## Observations: 9,432
## Observations: 9,441
## Variables: 16
## $ region_type <chr> "Census Regions", "Census Regions", "Census Regions", "Census Regions", "Census Regions", ...
## $ region <chr> "New England", "Mid-Atlantic", "East North Central", "West North Central", "South Atlantic...
@ -430,7 +441,7 @@ walk(c("national", "hhs", "census", "state"), ~{
## $ num_of_providers <dbl> 32, 13, 47, 17, 30, 9, 4, 16, 24, 29, 13, 46, 17, 32, 10, 4, 17, 23, 40, 12, 62, 16, 33, 1...
## $ total_patients <dbl> 7053, 2119, 9649, 2892, 6912, 4356, 669, 10719, 2473, 6987, 2384, 9427, 2823, 7591, 4947, ...
## $ week_start <date> 1997-10-06, 1997-10-06, 1997-10-06, 1997-10-06, 1997-10-06, 1997-10-06, 1997-10-06, 1997-...
## # A tibble: 9,432 x 16
## # A tibble: 9,441 x 16
## region_type region year week weighted_ili unweighted_ili age_0_4 age_25_49 age_25_64 age_5_24
## <chr> <chr> <int> <int> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 Census Regions New England 1997 40 0.4985350 0.6238480 15 NA 7 22
@ -443,12 +454,12 @@ walk(c("national", "hhs", "census", "state"), ~{
## 8 Census Regions Mountain 1997 40 2.2587800 2.2763300 87 NA 71 71
## 9 Census Regions Pacific 1997 40 2.0488300 3.2349400 26 NA 17 36
## 10 Census Regions New England 1997 41 0.6426690 0.8158010 14 NA 14 29
## # ... with 9,422 more rows, and 6 more variables: age_50_64 <dbl>, age_65 <dbl>, ilitotal <dbl>,
## # ... with 9,431 more rows, and 6 more variables: age_50_64 <dbl>, age_65 <dbl>, ilitotal <dbl>,
## # num_of_providers <dbl>, total_patients <dbl>, week_start <date>
![](README_files/figure-markdown_github-ascii_identifiers/unnamed-chunk-8-3.png)
![](README.gfm-ascii_identifiers_files/figure-gfm/unnamed-chunk-8-3.png)<!-- -->
## Observations: 19,718
## Observations: 19,772
## Variables: 16
## $ region_type <chr> "States", "States", "States", "States", "States", "States", "States", "States", "States", ...
## $ region <chr> "Alabama", "Alaska", "Arizona", "Arkansas", "California", "Colorado", "Connecticut", "Dela...
@ -466,7 +477,7 @@ walk(c("national", "hhs", "census", "state"), ~{
## $ num_of_providers <dbl> 35, 7, 49, 15, 112, 14, 12, 13, 4, NA, 62, 18, 12, 74, 44, 6, 40, 14, NA, 30, 17, 56, 47, ...
## $ total_patients <dbl> 11664, 1714, 25492, 2586, 32342, 20282, 3831, 3995, 2599, NA, 40314, 1943, 4579, 39390, 12...
## $ week_start <date> 2010-10-04, 2010-10-04, 2010-10-04, 2010-10-04, 2010-10-04, 2010-10-04, 2010-10-04, 2010-...
## # A tibble: 19,718 x 16
## # A tibble: 19,772 x 16
## region_type region year week weighted_ili unweighted_ili age_0_4 age_25_49 age_25_64 age_5_24
## <chr> <chr> <int> <int> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 States Alabama 2010 40 NA 2.1347700 NA NA NA NA
@ -479,10 +490,10 @@ walk(c("national", "hhs", "census", "state"), ~{
## 8 States Delaware 2010 40 NA 0.1001250 NA NA NA NA
## 9 States District of Columbia 2010 40 NA 2.8087700 NA NA NA NA
## 10 States Florida 2010 40 NA NA NA NA NA NA
## # ... with 19,708 more rows, and 6 more variables: age_50_64 <dbl>, age_65 <dbl>, ilitotal <dbl>,
## # ... with 19,762 more rows, and 6 more variables: age_50_64 <dbl>, age_65 <dbl>, ilitotal <dbl>,
## # num_of_providers <dbl>, total_patients <dbl>, week_start <date>
![](README_files/figure-markdown_github-ascii_identifiers/unnamed-chunk-8-4.png)
![](README.gfm-ascii_identifiers_files/figure-gfm/unnamed-chunk-8-4.png)<!-- -->
### Retrieve weekly state-level ILI indicators per-state for a given season
@ -490,27 +501,28 @@ walk(c("national", "hhs", "census", "state"), ~{
ili_weekly_activity_indicators(2017)
```
## # A tibble: 216 x 9
## statename ili_activity_label ili_activity_group statefips stateabbr weekend weeknumber year seasonid
## <chr> <fctr> <chr> <chr> <chr> <date> <int> <int> <int>
## 1 Alabama Level 2 Minimal 01 AL 2017-10-07 40 2017 57
## 2 Alabama Level 2 Minimal 01 AL 2017-10-14 41 2017 57
## 3 Alabama Level 2 Minimal 01 AL 2017-10-21 42 2017 57
## 4 Alabama Level 3 Minimal 01 AL 2017-10-28 43 2017 57
## 5 Alaska Level 1 Minimal 02 AK 2017-10-07 40 2017 57
## 6 Alaska Level 2 Minimal 02 AK 2017-10-14 41 2017 57
## 7 Alaska Level 4 Low 02 AK 2017-10-21 42 2017 57
## 8 Alaska Level 3 Minimal 02 AK 2017-10-28 43 2017 57
## 9 Arizona Level 2 Minimal 04 AZ 2017-10-07 40 2017 57
## 10 Arizona Level 3 Minimal 04 AZ 2017-10-14 41 2017 57
## # ... with 206 more rows
## # A tibble: 270 x 8
## statename url
## * <chr> <chr>
## 1 Virgin Islands http://doh.vi.gov/
## 2 Virgin Islands http://doh.vi.gov/
## 3 Virgin Islands http://doh.vi.gov/
## 4 Puerto Rico http://www.salud.gov.pr/Estadisticas-Registros-y-Publicaciones/Pages/Influenza.aspx
## 5 Virgin Islands http://doh.vi.gov/
## 6 Puerto Rico http://www.salud.gov.pr/Estadisticas-Registros-y-Publicaciones/Pages/Influenza.aspx
## 7 Virgin Islands http://doh.vi.gov/
## 8 Indiana http://www.in.gov/isdh/22104.htm
## 9 Iowa http://idph.iowa.gov/influenza/surveillance
## 10 Kansas http://www.kdheks.gov/flu/surveillance.htm
## # ... with 260 more rows, and 6 more variables: website <chr>, activity_level <dbl>, activity_level_label <chr>,
## # weekend <date>, season <chr>, weeknumber <dbl>
``` r
xdf <- map_df(2008:2017, ili_weekly_activity_indicators)
count(xdf, weekend, ili_activity_label) %>%
complete(weekend, ili_activity_label) %>%
ggplot(aes(weekend, ili_activity_label, fill=n)) +
count(xdf, weekend, activity_level_label) %>%
complete(weekend, activity_level_label) %>%
ggplot(aes(weekend, activity_level_label, fill=n)) +
geom_tile(color="#c2c2c2", size=0.1) +
scale_x_date(expand=c(0,0)) +
viridis::scale_fill_viridis(name="# States", na.value="White") +
@ -520,7 +532,7 @@ count(xdf, weekend, ili_activity_label) %>%
theme(legend.position="bottom")
```
![](README_files/figure-markdown_github-ascii_identifiers/unnamed-chunk-9-1.png)
![](README.gfm-ascii_identifiers_files/figure-gfm/unnamed-chunk-9-1.png)<!-- -->
### Pneumonia and Influenza Mortality Surveillance
@ -528,20 +540,20 @@ count(xdf, weekend, ili_activity_label) %>%
(nat_pi <- pi_mortality("national"))
```
## # A tibble: 419 x 19
## # A tibble: 420 x 19
## seasonid baseline threshold percent_pni percent_complete number_influenza number_pneumonia all_deaths total_pni
## <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 57 0.058 0.061 0.054 0.763 10 1962 36283 1972
## 2 57 0.058 0.062 0.056 0.675 10 1795 32107 1805
## 3 56 0.059 0.063 0.059 1.000 18 3022 51404 3040
## 4 56 0.060 0.063 0.061 1.000 11 3193 52130 3204
## 5 56 0.061 0.064 0.062 1.000 7 3178 51443 3185
## 6 56 0.062 0.065 0.061 1.000 17 3129 51865 3146
## 7 56 0.063 0.066 0.060 1.000 16 3099 51753 3115
## 8 56 0.064 0.067 0.061 1.000 19 3208 52541 3227
## 9 56 0.065 0.068 0.060 1.000 7 3192 53460 3199
## 10 56 0.066 0.069 0.062 1.000 22 3257 53163 3279
## # ... with 409 more rows, and 10 more variables: weeknumber <chr>, geo_description <chr>, age_label <chr>,
## 1 57 0.058 0.061 0.056 0.858 12 2276 40834 2288
## 2 57 0.058 0.062 0.056 0.764 14 2025 36328 2039
## 3 57 0.059 0.063 0.058 0.678 17 1844 32279 1861
## 4 56 0.059 0.063 0.059 1.000 18 3022 51404 3040
## 5 56 0.060 0.063 0.061 1.000 11 3193 52130 3204
## 6 56 0.061 0.064 0.062 1.000 7 3178 51443 3185
## 7 56 0.062 0.065 0.061 1.000 17 3129 51865 3146
## 8 56 0.063 0.066 0.060 1.000 16 3099 51753 3115
## 9 56 0.064 0.067 0.061 1.000 19 3208 52541 3227
## 10 56 0.065 0.068 0.060 1.000 7 3192 53460 3199
## # ... with 410 more rows, and 10 more variables: weeknumber <chr>, geo_description <chr>, age_label <chr>,
## # wk_start <date>, wk_end <date>, year_wk_num <int>, mmwrid <chr>, coverage_area <chr>, region_name <chr>,
## # callout <chr>
@ -558,47 +570,47 @@ select(nat_pi, wk_end, percent_pni, baseline, threshold) %>%
theme(legend.position="bottom")
```
![](README_files/figure-markdown_github-ascii_identifiers/unnamed-chunk-10-1.png)
![](README.gfm-ascii_identifiers_files/figure-gfm/unnamed-chunk-10-1.png)<!-- -->
``` r
(st_pi <- pi_mortality("state"))
(st_pi <- pi_mortality("state", years=2015))
```
## # A tibble: 21,788 x 19
## # A tibble: 2,704 x 19
## seasonid baseline threshold percent_pni percent_complete number_influenza number_pneumonia all_deaths total_pni
## <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 57 NA NA 0.065 0.836 0 50 772 50
## 2 57 NA NA 0.064 0.767 0 45 708 45
## 3 57 NA NA 0.063 0.666 1 2 48 3
## 4 57 NA NA 0.105 0.527 0 4 38 4
## 5 57 NA NA 0.053 0.412 0 20 374 20
## 6 57 NA NA 0.059 0.393 0 21 356 21
## 7 57 NA NA 0.060 0.751 0 25 420 25
## 8 57 NA NA 0.050 0.604 0 17 338 17
## 9 57 NA NA 0.065 0.774 1 228 3510 229
## 10 57 NA NA 0.059 0.758 2 201 3438 203
## # ... with 21,778 more rows, and 10 more variables: weeknumber <chr>, geo_description <chr>, age_label <chr>,
## 1 55 NA NA 0.047 1.000 0 46 979 46
## 2 55 NA NA 0.038 0.963 0 34 889 34
## 3 55 NA NA 0.053 1.000 0 52 977 52
## 4 55 NA NA 0.070 1.000 0 68 968 68
## 5 55 NA NA 0.053 0.981 0 48 906 48
## 6 55 NA NA 0.058 1.000 0 56 968 56
## 7 55 NA NA 0.051 1.000 0 53 1041 53
## 8 55 NA NA 0.062 1.000 1 63 1031 64
## 9 55 NA NA 0.056 1.000 0 55 976 55
## 10 55 NA NA 0.054 1.000 0 56 1045 56
## # ... with 2,694 more rows, and 10 more variables: weeknumber <chr>, geo_description <chr>, age_label <chr>,
## # wk_start <date>, wk_end <date>, year_wk_num <int>, mmwrid <chr>, coverage_area <chr>, region_name <chr>,
## # callout <chr>
``` r
(reg_pi <- pi_mortality("region"))
(reg_pi <- pi_mortality("region", years=2015))
```
## # A tibble: 4,190 x 19
## # A tibble: 520 x 19
## seasonid baseline threshold percent_pni percent_complete number_influenza number_pneumonia all_deaths total_pni
## <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 57 0.060 0.067 0.051 0.735 0 85 1683 85
## 2 57 0.061 0.068 0.060 0.701 0 96 1605 96
## 3 57 0.060 0.065 0.061 0.608 1 154 2524 155
## 4 57 0.060 0.066 0.063 0.602 1 157 2497 158
## 5 57 0.053 0.058 0.045 0.511 1 115 2575 116
## 6 57 0.054 0.059 0.045 0.440 1 98 2215 99
## 7 57 0.056 0.060 0.051 0.744 3 394 7753 397
## 8 57 0.057 0.061 0.052 0.651 1 354 6778 355
## 9 57 0.055 0.059 0.052 0.914 1 403 7701 404
## 10 57 0.056 0.060 0.054 0.799 4 358 6733 362
## # ... with 4,180 more rows, and 10 more variables: weeknumber <chr>, geo_description <chr>, age_label <chr>,
## 1 55 0.065 0.073 0.071 1 0 178 2520 178
## 2 55 0.066 0.073 0.063 1 0 159 2505 159
## 3 55 0.067 0.074 0.058 1 1 141 2452 142
## 4 55 0.068 0.075 0.071 1 0 171 2422 171
## 5 55 0.069 0.076 0.066 1 2 166 2554 168
## 6 55 0.070 0.077 0.067 1 1 160 2404 161
## 7 55 0.071 0.079 0.079 1 0 195 2478 195
## 8 55 0.073 0.080 0.072 1 1 176 2463 177
## 9 55 0.074 0.081 0.067 1 3 154 2347 157
## 10 55 0.075 0.082 0.062 1 0 151 2437 151
## # ... with 510 more rows, and 10 more variables: weeknumber <chr>, geo_description <chr>, age_label <chr>,
## # wk_start <date>, wk_end <date>, year_wk_num <int>, mmwrid <chr>, coverage_area <chr>, region_name <chr>,
## # callout <chr>
@ -645,32 +657,32 @@ glimpse(xdat <- who_nrevss("national"))
## ..$ b : int [1:940] 0 0 1 0 0 0 1 1 1 1 ...
## ..$ h3n2v : int [1:940] 0 0 0 0 0 0 0 0 0 0 ...
## ..$ wk_date : Date[1:940], format: "1997-09-28" "1997-10-05" "1997-10-12" "1997-10-19" ...
## $ public_health_labs :Classes 'tbl_df', 'tbl' and 'data.frame': 108 obs. of 13 variables:
## ..$ region_type : chr [1:108] "National" "National" "National" "National" ...
## ..$ region : chr [1:108] "National" "National" "National" "National" ...
## ..$ year : int [1:108] 2015 2015 2015 2015 2015 2015 2015 2015 2015 2015 ...
## ..$ week : int [1:108] 40 41 42 43 44 45 46 47 48 49 ...
## ..$ total_specimens : int [1:108] 1139 1152 1198 1244 1465 1393 1458 1157 1550 1518 ...
## ..$ a_2009_h1n1 : int [1:108] 4 5 10 9 4 11 17 17 27 38 ...
## ..$ a_h3 : int [1:108] 65 41 50 31 23 34 42 24 36 37 ...
## ..$ a_subtyping_not_performed: int [1:108] 2 2 1 4 4 1 1 0 3 3 ...
## ..$ b : int [1:108] 10 7 8 9 9 10 4 4 9 11 ...
## ..$ bvic : int [1:108] 0 3 3 1 1 4 0 3 3 2 ...
## ..$ byam : int [1:108] 1 0 2 4 4 2 4 9 12 11 ...
## ..$ h3n2v : int [1:108] 0 0 0 0 0 0 0 0 0 0 ...
## ..$ wk_date : Date[1:108], format: "2015-10-04" "2015-10-11" "2015-10-18" "2015-10-25" ...
## $ clinical_labs :Classes 'tbl_df', 'tbl' and 'data.frame': 108 obs. of 11 variables:
## ..$ region_type : chr [1:108] "National" "National" "National" "National" ...
## ..$ region : chr [1:108] "National" "National" "National" "National" ...
## ..$ year : int [1:108] 2015 2015 2015 2015 2015 2015 2015 2015 2015 2015 ...
## ..$ week : int [1:108] 40 41 42 43 44 45 46 47 48 49 ...
## ..$ total_specimens : int [1:108] 12029 13111 13441 13537 14687 15048 15250 15234 16201 16673 ...
## ..$ total_a : int [1:108] 84 116 97 98 97 122 84 119 145 140 ...
## ..$ total_b : int [1:108] 43 54 52 52 68 86 98 92 81 106 ...
## ..$ percent_positive: num [1:108] 1.06 1.3 1.11 1.11 1.12 ...
## ..$ percent_a : num [1:108] 0.698 0.885 0.722 0.724 0.66 ...
## ..$ percent_b : num [1:108] 0.357 0.412 0.387 0.384 0.463 ...
## ..$ wk_date : Date[1:108], format: "2015-10-04" "2015-10-11" "2015-10-18" "2015-10-25" ...
## $ public_health_labs :Classes 'tbl_df', 'tbl' and 'data.frame': 109 obs. of 13 variables:
## ..$ region_type : chr [1:109] "National" "National" "National" "National" ...
## ..$ region : chr [1:109] "National" "National" "National" "National" ...
## ..$ year : int [1:109] 2015 2015 2015 2015 2015 2015 2015 2015 2015 2015 ...
## ..$ week : int [1:109] 40 41 42 43 44 45 46 47 48 49 ...
## ..$ total_specimens : int [1:109] 1139 1152 1198 1244 1465 1393 1458 1157 1550 1518 ...
## ..$ a_2009_h1n1 : int [1:109] 4 5 10 9 4 11 17 17 27 38 ...
## ..$ a_h3 : int [1:109] 65 41 50 31 23 34 42 24 36 37 ...
## ..$ a_subtyping_not_performed: int [1:109] 2 2 1 4 4 1 1 0 3 3 ...
## ..$ b : int [1:109] 10 7 8 9 9 10 4 4 9 11 ...
## ..$ bvic : int [1:109] 0 3 3 1 1 4 0 3 3 2 ...
## ..$ byam : int [1:109] 1 0 2 4 4 2 4 9 12 11 ...
## ..$ h3n2v : int [1:109] 0 0 0 0 0 0 0 0 0 0 ...
## ..$ wk_date : Date[1:109], format: "2015-10-04" "2015-10-11" "2015-10-18" "2015-10-25" ...
## $ clinical_labs :Classes 'tbl_df', 'tbl' and 'data.frame': 109 obs. of 11 variables:
## ..$ region_type : chr [1:109] "National" "National" "National" "National" ...
## ..$ region : chr [1:109] "National" "National" "National" "National" ...
## ..$ year : int [1:109] 2015 2015 2015 2015 2015 2015 2015 2015 2015 2015 ...
## ..$ week : int [1:109] 40 41 42 43 44 45 46 47 48 49 ...
## ..$ total_specimens : int [1:109] 12029 13111 13441 13537 14687 15048 15250 15234 16201 16673 ...
## ..$ total_a : int [1:109] 84 116 97 98 97 122 84 119 145 140 ...
## ..$ total_b : int [1:109] 43 54 52 52 68 86 98 92 81 106 ...
## ..$ percent_positive: num [1:109] 1.06 1.3 1.11 1.11 1.12 ...
## ..$ percent_a : num [1:109] 0.698 0.885 0.722 0.724 0.66 ...
## ..$ percent_b : num [1:109] 0.357 0.412 0.387 0.384 0.463 ...
## ..$ wk_date : Date[1:109], format: "2015-10-04" "2015-10-11" "2015-10-18" "2015-10-25" ...
``` r
mutate(xdat$combined_prior_to_2015_16,
@ -682,168 +694,117 @@ mutate(xdat$combined_prior_to_2015_16,
theme_ipsum_rc(grid="XY")
```
![](README_files/figure-markdown_github-ascii_identifiers/unnamed-chunk-12-1.png)
![](README.gfm-ascii_identifiers_files/figure-gfm/unnamed-chunk-12-1.png)<!-- -->
``` r
who_nrevss("hhs")
who_nrevss("hhs", years=2016)
```
## $combined_prior_to_2015_16
## # A tibble: 9,400 x 14
## region_type region year week total_specimens percent_positive a_2009_h1n1 a_h1 a_h3 a_subtyping_not_performed
## <chr> <chr> <int> <int> <int> <dbl> <int> <int> <int> <int>
## 1 HHS Regions Region 1 1997 40 51 0 0 0 0 0
## 2 HHS Regions Region 2 1997 40 152 0 0 0 0 0
## 3 HHS Regions Region 3 1997 40 143 0 0 0 0 0
## 4 HHS Regions Region 4 1997 40 98 0 0 0 0 0
## 5 HHS Regions Region 5 1997 40 147 0 0 0 0 0
## 6 HHS Regions Region 6 1997 40 343 0 0 0 0 0
## 7 HHS Regions Region 7 1997 40 133 0 0 0 0 0
## 8 HHS Regions Region 8 1997 40 78 0 0 0 0 0
## 9 HHS Regions Region 9 1997 40 98 0 0 0 0 0
## 10 HHS Regions Region 10 1997 40 48 0 0 0 0 0
## # ... with 9,390 more rows, and 4 more variables: a_unable_to_subtype <int>, b <int>, h3n2v <int>, wk_date <date>
##
## $public_health_labs
## # A tibble: 1,080 x 13
## # A tibble: 520 x 13
## region_type region year week total_specimens a_2009_h1n1 a_h3 a_subtyping_not_performed b bvic byam
## <chr> <chr> <int> <chr> <int> <int> <int> <int> <int> <int> <int>
## 1 HHS Regions Region 1 2015 <NA> 39 0 5 0 0 0 0
## 2 HHS Regions Region 2 2015 <NA> 56 1 4 0 1 0 0
## 3 HHS Regions Region 3 2015 <NA> 132 1 3 0 0 0 0
## 4 HHS Regions Region 4 2015 <NA> 83 0 5 0 1 0 0
## 5 HHS Regions Region 5 2015 <NA> 218 2 7 0 0 0 1
## 6 HHS Regions Region 6 2015 <NA> 97 0 2 0 0 0 0
## 7 HHS Regions Region 7 2015 <NA> 36 0 2 0 0 0 0
## 8 HHS Regions Region 8 2015 <NA> 71 0 2 0 0 0 0
## 9 HHS Regions Region 9 2015 <NA> 273 0 22 2 8 0 0
## 10 HHS Regions Region 10 2015 <NA> 134 0 13 0 0 0 0
## # ... with 1,070 more rows, and 2 more variables: h3n2v <int>, wk_date <date>
## 1 HHS Regions Region 1 2016 <NA> 31 0 6 0 0 0 0
## 2 HHS Regions Region 2 2016 <NA> 31 0 6 0 0 2 0
## 3 HHS Regions Region 3 2016 <NA> 112 2 2 0 0 0 0
## 4 HHS Regions Region 4 2016 <NA> 112 1 11 0 1 2 0
## 5 HHS Regions Region 5 2016 <NA> 204 0 7 0 0 0 1
## 6 HHS Regions Region 6 2016 <NA> 39 1 1 0 0 0 0
## 7 HHS Regions Region 7 2016 <NA> 24 0 2 0 0 1 0
## 8 HHS Regions Region 8 2016 <NA> 46 2 8 0 0 0 0
## 9 HHS Regions Region 9 2016 <NA> 186 3 27 0 0 0 3
## 10 HHS Regions Region 10 2016 <NA> 113 0 17 0 0 0 0
## # ... with 510 more rows, and 2 more variables: h3n2v <int>, wk_date <date>
##
## $clinical_labs
## # A tibble: 1,080 x 11
## # A tibble: 520 x 11
## region_type region year week total_specimens total_a total_b percent_positive percent_a percent_b wk_date
## <chr> <chr> <int> <int> <int> <int> <int> <dbl> <dbl> <dbl> <date>
## 1 HHS Regions Region 1 2015 40 693 2 3 0.721501 0.288600 0.432900 2015-10-04
## 2 HHS Regions Region 2 2015 40 1220 5 0 0.409836 0.409836 0.000000 2015-10-04
## 3 HHS Regions Region 3 2015 40 896 0 1 0.111607 0.000000 0.111607 2015-10-04
## 4 HHS Regions Region 4 2015 40 2486 24 16 1.609010 0.965406 0.643604 2015-10-04
## 5 HHS Regions Region 5 2015 40 2138 14 3 0.795136 0.654818 0.140318 2015-10-04
## 6 HHS Regions Region 6 2015 40 1774 8 16 1.352870 0.450958 0.901917 2015-10-04
## 7 HHS Regions Region 7 2015 40 621 2 1 0.483092 0.322061 0.161031 2015-10-04
## 8 HHS Regions Region 8 2015 40 824 1 1 0.242718 0.121359 0.121359 2015-10-04
## 9 HHS Regions Region 9 2015 40 980 25 2 2.755100 2.551020 0.204082 2015-10-04
## 10 HHS Regions Region 10 2015 40 397 3 0 0.755668 0.755668 0.000000 2015-10-04
## # ... with 1,070 more rows
## 1 HHS Regions Region 1 2016 40 654 5 1 0.917431 0.764526 0.1529050 2016-10-02
## 2 HHS Regions Region 2 2016 40 1307 10 3 0.994644 0.765111 0.2295330 2016-10-02
## 3 HHS Regions Region 3 2016 40 941 1 4 0.531350 0.106270 0.4250800 2016-10-02
## 4 HHS Regions Region 4 2016 40 2758 46 62 3.915880 1.667880 2.2480100 2016-10-02
## 5 HHS Regions Region 5 2016 40 2386 8 5 0.544845 0.335289 0.2095560 2016-10-02
## 6 HHS Regions Region 6 2016 40 1914 22 13 1.828630 1.149430 0.6792060 2016-10-02
## 7 HHS Regions Region 7 2016 40 723 0 0 0.000000 0.000000 0.0000000 2016-10-02
## 8 HHS Regions Region 8 2016 40 913 8 0 0.876232 0.876232 0.0000000 2016-10-02
## 9 HHS Regions Region 9 2016 40 1123 7 1 0.712378 0.623330 0.0890472 2016-10-02
## 10 HHS Regions Region 10 2016 40 590 14 0 2.372880 2.372880 0.0000000 2016-10-02
## # ... with 510 more rows
``` r
who_nrevss("census")
who_nrevss("census", years=2016)
```
## $combined_prior_to_2015_16
## # A tibble: 8,460 x 14
## region_type region year week total_specimens percent_positive a_2009_h1n1 a_h1 a_h3
## <chr> <chr> <int> <int> <int> <dbl> <int> <int> <int>
## 1 Census Regions New England 1997 40 51 0 0 0 0
## 2 Census Regions Mid-Atlantic 1997 40 155 0 0 0 0
## 3 Census Regions East North Central 1997 40 127 0 0 0 0
## 4 Census Regions West North Central 1997 40 183 0 0 0 0
## 5 Census Regions South Atlantic 1997 40 204 0 0 0 0
## 6 Census Regions East South Central 1997 40 34 0 0 0 0
## 7 Census Regions West South Central 1997 40 339 0 0 0 0
## 8 Census Regions Mountain 1997 40 85 0 0 0 0
## 9 Census Regions Pacific 1997 40 113 0 0 0 0
## 10 Census Regions New England 1997 41 54 0 0 0 0
## # ... with 8,450 more rows, and 5 more variables: a_subtyping_not_performed <int>, a_unable_to_subtype <int>, b <int>,
## # h3n2v <int>, wk_date <date>
##
## $public_health_labs
## # A tibble: 972 x 13
## # A tibble: 468 x 13
## region_type region year week total_specimens a_2009_h1n1 a_h3 a_subtyping_not_performed b
## <chr> <chr> <int> <chr> <int> <int> <int> <int> <int>
## 1 Census Regions New England 2015 <NA> 39 0 5 0 0
## 2 Census Regions Mid-Atlantic 2015 <NA> 63 1 5 0 1
## 3 Census Regions East North Central 2015 <NA> 91 2 5 0 0
## 4 Census Regions West North Central 2015 <NA> 169 0 4 0 0
## 5 Census Regions South Atlantic 2015 <NA> 187 1 7 0 0
## 6 Census Regions East South Central 2015 <NA> 21 0 0 0 1
## 7 Census Regions West South Central 2015 <NA> 72 0 2 0 0
## 8 Census Regions Mountain 2015 <NA> 111 0 6 0 0
## 9 Census Regions Pacific 2015 <NA> 386 0 31 2 8
## 10 Census Regions New England 2015 <NA> 39 2 3 0 0
## # ... with 962 more rows, and 4 more variables: bvic <int>, byam <int>, h3n2v <int>, wk_date <date>
## 1 Census Regions New England 2016 <NA> 31 0 6 0 0
## 2 Census Regions Mid-Atlantic 2016 <NA> 50 0 8 0 0
## 3 Census Regions East North Central 2016 <NA> 139 0 4 0 0
## 4 Census Regions West North Central 2016 <NA> 103 0 6 0 0
## 5 Census Regions South Atlantic 2016 <NA> 181 3 11 0 1
## 6 Census Regions East South Central 2016 <NA> 24 0 0 0 0
## 7 Census Regions West South Central 2016 <NA> 27 0 1 0 0
## 8 Census Regions Mountain 2016 <NA> 54 3 10 0 0
## 9 Census Regions Pacific 2016 <NA> 289 3 41 0 0
## 10 Census Regions New England 2016 <NA> 14 0 2 0 0
## # ... with 458 more rows, and 4 more variables: bvic <int>, byam <int>, h3n2v <int>, wk_date <date>
##
## $clinical_labs
## # A tibble: 972 x 11
## # A tibble: 468 x 11
## region_type region year week total_specimens total_a total_b percent_positive percent_a percent_b
## <chr> <chr> <int> <int> <int> <int> <int> <dbl> <dbl> <dbl>
## 1 Census Regions New England 2015 40 693 2 3 0.721501 0.288600 0.4329000
## 2 Census Regions Mid-Atlantic 2015 40 1584 5 1 0.378788 0.315657 0.0631313
## 3 Census Regions East North Central 2015 40 1918 13 3 0.834202 0.677789 0.1564130
## 4 Census Regions West North Central 2015 40 978 3 1 0.408998 0.306748 0.1022490
## 5 Census Regions South Atlantic 2015 40 2403 20 12 1.331670 0.832293 0.4993760
## 6 Census Regions East South Central 2015 40 615 4 4 1.300810 0.650407 0.6504070
## 7 Census Regions West South Central 2015 40 1592 8 16 1.507540 0.502513 1.0050300
## 8 Census Regions Mountain 2015 40 943 1 1 0.212089 0.106045 0.1060450
## 9 Census Regions Pacific 2015 40 1303 28 2 2.302380 2.148890 0.1534920
## 10 Census Regions New England 2015 41 752 11 4 1.994680 1.462770 0.5319150
## # ... with 962 more rows, and 1 more variables: wk_date <date>
## 1 Census Regions New England 2016 40 654 5 1 0.917431 0.764526 0.1529050
## 2 Census Regions Mid-Atlantic 2016 40 1579 10 4 0.886637 0.633312 0.2533250
## 3 Census Regions East North Central 2016 40 2176 6 5 0.505515 0.275735 0.2297790
## 4 Census Regions West North Central 2016 40 1104 3 0 0.271739 0.271739 0.0000000
## 5 Census Regions South Atlantic 2016 40 2610 43 62 4.022990 1.647510 2.3754800
## 6 Census Regions East South Central 2016 40 817 4 3 0.856793 0.489596 0.3671970
## 7 Census Regions West South Central 2016 40 1738 21 13 1.956270 1.208290 0.7479860
## 8 Census Regions Mountain 2016 40 1067 8 0 0.749766 0.749766 0.0000000
## 9 Census Regions Pacific 2016 40 1564 21 1 1.406650 1.342710 0.0639386
## 10 Census Regions New England 2016 41 810 5 1 0.740741 0.617284 0.1234570
## # ... with 458 more rows, and 1 more variables: wk_date <date>
``` r
who_nrevss("state")
who_nrevss("state", years=2016)
```
## $combined_prior_to_2015_16
## # A tibble: 14,094 x 14
## region_type region year week total_specimens percent_positive a_2009_h1n1 a_h1 a_h3
## <chr> <chr> <int> <int> <chr> <chr> <chr> <chr> <chr>
## 1 States Alabama 2010 40 54 0 0 0 0
## 2 States Alaska 2010 40 40 0 0 0 0
## 3 States Arizona 2010 40 40 2.5 0 0 1
## 4 States Arkansas 2010 40 15 0 0 0 0
## 5 States California 2010 40 183 3.28 2 0 3
## 6 States Colorado 2010 40 126 0.79 0 0 1
## 7 States Connecticut 2010 40 54 0 0 0 0
## 8 States Delaware 2010 40 75 4 0 0 3
## 9 States District of Columbia 2010 40 14 0 0 0 0
## 10 States Florida 2010 40 <NA> <NA> <NA> <NA> <NA>
## # ... with 14,084 more rows, and 5 more variables: a_subtyping_not_performed <chr>, a_unable_to_subtype <chr>, b <chr>,
## # h3n2v <chr>, wk_date <date>
##
## $public_health_labs
## # A tibble: 162 x 12
## # A tibble: 54 x 12
## region_type region season_description total_specimens a_2009_h1n1 a_h3 a_subtyping_not_performed
## <chr> <chr> <chr> <chr> <chr> <chr> <chr>
## 1 States Alabama Season 2015-16 256 59 16 1
## 2 States Alaska Season 2015-16 4691 607 98 0
## 3 States Arizona Season 2015-16 2110 762 580 0
## 4 States Arkansas Season 2015-16 128 20 8 0
## 5 States California Season 2015-16 12241 1394 825 28
## 6 States Colorado Season 2015-16 1625 912 243 3
## 7 States Connecticut Season 2015-16 1581 662 52 0
## 8 States Delaware Season 2015-16 2754 414 20 12
## 9 States District of Columbia Season 2015-16 172 68 3 0
## 10 States Florida Season 2015-16 <NA> <NA> <NA> <NA>
## # ... with 152 more rows, and 5 more variables: b <chr>, bvic <chr>, byam <chr>, h3n2v <chr>, wk_date <date>
## 1 States Alabama Season 2016-17 549 3 222 0
## 2 States Alaska Season 2016-17 5226 14 905 3
## 3 States Arizona Season 2016-17 2974 63 1630 0
## 4 States Arkansas Season 2016-17 121 0 51 0
## 5 States California Season 2016-17 14033 184 4694 120
## 6 States Colorado Season 2016-17 715 3 267 2
## 7 States Connecticut Season 2016-17 1347 19 968 0
## 8 States Delaware Season 2016-17 3090 5 659 4
## 9 States District of Columbia Season 2016-17 69 1 32 0
## 10 States Florida Season 2016-17 <NA> <NA> <NA> <NA>
## # ... with 44 more rows, and 5 more variables: b <chr>, bvic <chr>, byam <chr>, h3n2v <chr>, wk_date <date>
##
## $clinical_labs
## # A tibble: 5,832 x 11
## # A tibble: 2,808 x 11
## region_type region year week total_specimens total_a total_b percent_positive percent_a percent_b
## <chr> <chr> <int> <int> <chr> <chr> <chr> <chr> <chr> <chr>
## 1 States Alabama 2015 40 167 2 3 2.99 1.2 1.8
## 2 States Alaska 2015 40 <NA> <NA> <NA> <NA> <NA> <NA>
## 3 States Arizona 2015 40 55 0 0 0 0 0
## 4 States Arkansas 2015 40 26 0 1 3.85 0 3.85
## 5 States California 2015 40 679 2 0 0.29 0.29 0
## 6 States Colorado 2015 40 255 0 1 0.39 0 0.39
## 7 States Connecticut 2015 40 304 1 0 0.33 0.33 0
## 8 States Delaware 2015 40 22 0 0 0 0 0
## 9 States District of Columbia 2015 40 <NA> <NA> <NA> <NA> <NA> <NA>
## 10 States Florida 2015 40 <NA> <NA> <NA> <NA> <NA> <NA>
## # ... with 5,822 more rows, and 1 more variables: wk_date <date>
Code of Conduct
---------------
## 1 States Alabama 2016 40 379 4 0 1.06 1.06 0
## 2 States Alaska 2016 40 <NA> <NA> <NA> <NA> <NA> <NA>
## 3 States Arizona 2016 40 133 0 0 0 0 0
## 4 States Arkansas 2016 40 47 0 0 0 0 0
## 5 States California 2016 40 799 3 0 0.38 0.38 0
## 6 States Colorado 2016 40 260 0 0 0 0 0
## 7 States Connecticut 2016 40 199 3 0 1.51 1.51 0
## 8 States Delaware 2016 40 40 0 0 0 0 0
## 9 States District of Columbia 2016 40 <NA> <NA> <NA> <NA> <NA> <NA>
## 10 States Florida 2016 40 <NA> <NA> <NA> <NA> <NA> <NA>
## # ... with 2,798 more rows, and 1 more variables: wk_date <date>
## Code of Conduct
Please note that this project is released with a [Contributor Code of
Conduct](CONDUCT.md). By participating in this project you agree to

2
tests/testthat/test-cdcfluview.R

@ -68,6 +68,8 @@ test_that("Old API works", {
invisible(get_flu_data())
invisible(get_hosp_data())
invisible(get_flu_data(data_source="all"))
invisible(get_weekly_flu_report())

Loading…
Cancel
Save