get_influenza_cdc_ili: Get CDC Influenza-like Illness (ILI) Data

View source: R/get_influenza_cdc_ili.R

get_influenza_cdc_iliR Documentation

Get CDC Influenza-like Illness (ILI) Data

Description

Retrieves ILI data for the 2019 and 2020 influenza outbreaks from the US CDC.

Usage

get_influenza_cdc_ili()

Details

This endpoint provides historical data for flu-like symptoms reported in the United States, sourced from the CDC ILINet. Requires an active internet connection.

Value

A list containing:

  • updated: Last update timestamp (POSIXct).

  • source: Source of the data.

  • data: A data frame with the following columns:

    • week: Week of reporting.

    • age 5-24, age 25-49, age 50-64, age 64+: ILI counts per age group.

    • totalILI: Total ILI cases.

    • totalPatients: Total patients.

Returns NULL if the API is unavailable or an error occurs.

Note

Requires internet connection. Function fails gracefully if API is unavailable.

References

API Docs: https://disease.sh/docs/#/Influenza/get_v3_influenza_cdc_ILINet

Examples

## Not run: 
ili_data <- get_influenza_cdc_ili()
if (!is.null(ili_data)) {
  print(ili_data$updated)
  head(ili_data$data)
}

## End(Not run)


infectiousR documentation built on Nov. 9, 2025, 5:07 p.m.