get_hosp_data: Retrieves influenza hospitalization statistics from the CDC...

Description Usage Arguments Value Note Examples

View source: R/get-hosp-data.r

Description

Uses the data source from the CDC FluView and provides influenza hospitalization reporting data as a data frame.

Usage

1
2
3
4
5
get_hosp_data(
  area = "flusurvnet",
  age_group = "overall",
  years = as.numeric(format(Sys.Date(), "%Y")) - 1
)

Arguments

area

one of "flusurvnet", "eip", "ihsp", or two digit state abbreviation for an individual site. Exceptions are New York - Albany ("nya") and New York - Rochester ("nyr")

age_group

a vector of age groups to pull data for. Possible values are: "overall", "0-4y", "5-17y, "18-49y, "50-64y, "65+y".

years

a vector of years to retrieve data for (i.e. 2014 for CDC flu season 2014-2015). Default value is the current year and all years values should be >= 2009

Value

A single data.frame.

Note

There is often a noticeable delay when making the API request to the CDC. This is not due to a large download size, but the time it takes for their servers to crunch the data. Wrap the function call in httr::with_verbose if you would like to see what's going on.

Examples

1
2
3
4
5
## Not run: 
# All of FluSurv-NET, 50-64 years old, 2010/11-2014/15 flu seasons
hosp <- get_hosp_data("flusurvnet", "50-64y", years=2010:2014)

## End(Not run)

cdcfluview documentation built on May 22, 2021, 5:07 p.m.