get_covid_stats_by_country_name {infectiousR} | R Documentation |
Get COVID-19 Statistics for a Specific Country
Description
Retrieves COVID-19 totals for a given country using the 'disease.sh' API.
Usage
get_covid_stats_by_country_name(
country,
yesterday = FALSE,
twoDaysAgo = FALSE,
strict = TRUE,
allowNull = FALSE
)
Arguments
country |
Character. A country name, ISO2, ISO3 code, or country ID. |
yesterday |
Logical. If |
twoDaysAgo |
Logical. If |
strict |
Logical. If |
allowNull |
Logical. If |
Details
This function accesses COVID-19 data for a specific country based on its name or ISO code.
Value
A data frame with the following columns:
-
country
: Country name. -
updated
: Timestamp of last update (POSIXct in UTC). -
cases
: Total confirmed cases. -
todayCases
: New confirmed cases today. -
deaths
: Total deaths. -
recovered
: Total recoveries. -
population
: Estimated population.
Note
Requires internet connection.
References
API Docs: https://disease.sh/docs/#/COVID-19
Examples
# Get data for Brazil
get_covid_stats_by_country_name("Brazil")
# Get data for the USA using ISO2 code
get_covid_stats_by_country_name("US", yesterday = TRUE)