View source: R/get_us_states_covid_stats.R
get_us_states_covid_stats | R Documentation |
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).
get_us_states_covid_stats()
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).
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.
An internet connection is required to use this function.
API Docs: https://disease.sh/docs/#/COVID-19:
us_states_stats <- get_us_states_covid_stats()
head(us_states_stats)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.