Skip to contents

Pulls weekly hospitalization count data from the NHSN (National Healthcare Safety Network) via the epidatr package for influenza, COVID-19, or RSV.

Usage

get_nhsn_data(
  disease = "influenza",
  geo_values = "MD",
  forecast_date = "2025-10-12",
  save_data = TRUE
)

Arguments

disease

Character string specifying the disease. Must be one of: "influenza", "covid", or "rsv" (case-insensitive).

geo_values

Character vector of geographic locations (e.g., state abbreviations like "CA", "NY"). Default is "MD" for Maryland data.

forecast_date

Character vector of the date of forecast in "YYYY-MM-DD". Should be a Sunday.

save_data

Logical. If TRUE, saves the retrieved data to a CSV file in the working directory.

Value

A data frame containing NHSN hospitalization data with columns typically including geo_value, time_value, and hospitalization counts.

Examples

if (FALSE) { # \dontrun{
# Get COVID-19 data for California and New York for specific weeks
covid_data <- get_nhsn_data(
  disease = "covid",
  geo_values = c("ca", "ny"),
  forecast_date = "2025-10-12"
)

# Get influenza data for California and New York for specific weeks
flu_data <- get_nhsn_data(
  disease = "influenza",
  geo_values = c("ca", "ny"),
  forecast_date = "2025-10-12"
)

# Get RSV data for MD
rsv_data <- get_nhsn_data(
  disease = "rsv",
  geo_values = "MD",
  forecast_date = "2025-10-12"
)
} # }