
Get COVID-19 Statistics for U.S. States and Territories
Source:R/get_us_states_covid_stats.R
get_us_states_covid_stats.RdRetrieves 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).
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.
Returns NULL if the API is unavailable or an error occurs.
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). Requires an active internet connection.