get_covid_stats_by_continent: Get COVID-19 Statistics for All Continents

View source: R/get_covid_stats_by_continent.R

get_covid_stats_by_continentR Documentation

Get COVID-19 Statistics for All Continents

Description

Retrieves real-time COVID-19 totals for all continents from the 'disease.sh' API.

Usage

get_covid_stats_by_continent(
  yesterday = FALSE,
  twoDaysAgo = FALSE,
  sort = NULL,
  allowNull = FALSE
)

Arguments

yesterday

Logical. If TRUE, retrieves data reported from the previous day. Default is FALSE.

twoDaysAgo

Logical. If TRUE, retrieves data reported two days ago. Default is FALSE.

sort

Character. Field to sort results by. Options include: "cases", "todayCases", "deaths", "recovered", "active", etc.

allowNull

Logical. If TRUE, missing values are returned as NA instead of 0. Default is FALSE.

Details

This function retrieves COVID-19 summary data for each continent. You may specify whether to get data from today, yesterday, or two days ago.

Value

A data frame containing:

  • continent: Continent name.

  • updated: Last updated timestamp (as POSIXct in UTC).

  • cases: Total confirmed cases.

  • todayCases: New confirmed cases today.

  • deaths: Total deaths.

  • todayDeaths: New deaths today.

  • population: Continent population estimate.

Note

Requires internet access.

References

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

Examples


# Get current COVID-19 stats for all continents
get_covid_stats_by_continent()

# Get yesterday's data sorted by number of cases
get_covid_stats_by_continent(yesterday = TRUE, sort = "cases")



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