get_us_states_covid_stats: Get COVID-19 Statistics for U.S. States and Territories

View source: R/get_us_states_covid_stats.R

get_us_states_covid_statsR Documentation

Get COVID-19 Statistics for U.S. States and Territories

Description

Retrieves real-time COVID-19 totals from the 'disease.sh' API for all 50 U.S. states, as well as U.S. territories (e.g., Puerto Rico, Guam), special jurisdictions (e.g., Veteran Affairs, U.S. Military), and others (e.g., cruise ships, repatriated individuals).

Usage

get_us_states_covid_stats()

Details

This function sends a GET request to the 'disease.sh' API endpoint for US state-level COVID-19 statistics and parses the response into a structured data frame. The timestamp is converted to a readable date-time format (in UTC).

Value

A data frame with the following columns:

  • state: Name of the U.S. state.

  • cases: Total confirmed cases in the state.

  • todayCases: New confirmed cases today.

  • deaths: Total deaths in the state.

  • todayDeaths: New deaths today.

  • active: Current active cases.

  • population: Estimated state population.

Note

An internet connection is required to use this function.

References

API Docs: https://disease.sh/docs/#/COVID-19:

Examples


us_states_stats <- get_us_states_covid_stats()
head(us_states_stats)



infectiousR documentation built on June 16, 2025, 5:09 p.m.