API : covidvirus

Access data on the 2019 Novel Coronavirus COVID-19 (2019-nCoV) epidemic through the covidvirus API.

Thierry Warin https://www.nuance-r.com/principalInvestigator.html (SKEMA Business School (Raleigh, NC))https://www.skemagloballab.io
03-02-2020

Table of Contents


By using SKEMA Quantum Studio framework (Warin 2019), this course will teach you how to use the covidvirus package.

Database description

Daily summary of the Coronavirus (COVID-19) cases by state/province.

Functions

This package gives access to the daily summary of Coronavirus cases (confirmed, death, and recovered), by state/province.The function below allows you to download data from the Johns Hopkins University Center for Systems Science and Engineering (JHU CCSE) Coronavirus website

get_cases()

This is a basic example which shows you how to solve a common problem :


# load covidvirus library
library(covidvirus)

# extract data
corona_virus <- get_cases()

Similar to the coronavirus package created by Rami Krispin, the output is as follows:


head(corona_virus)

tail(corona_virus)

Here’s an example of total cases by region and type (top 10):


# load dplyr library
library(dplyr)

# get total cases by region and type
corona_virus %>%
  group_by(country_region, type) %>%
  summarize(total_cases = sum(cases)) %>%
  arrange(desc(total_cases)) %>%
  head(20)


tl;dr


library(covidvirus)
corona_virus <- get_cases()

head(corona_virus)
tail(corona_virus)

library(dplyr)

corona_virus %>%
  group_by(country_region, type) %>%
  summarize(total_cases = sum(cases)) %>%
  arrange(desc(total_cases)) %>%
  head(20)

Code learned this week

Command Detail
get_cases() Get data for of all Corona Virus cases

References

This course uses the Covidvirus package, created by Nik Agarwal.


Warin, Thierry. 2019. “SKEMA Quantum Studio: A Technological Framework for Data Science in Higher Education.” https://doi.org/10.6084/m9.figshare.8204195.v2.

Citation

For attribution, please cite this work as

Warin (2020, March 2). Virtual Campus: API : covidvirus. Retrieved from https://virtualcampus.skemagloballab.io/posts/api-covidvirus/

BibTeX citation

@misc{warin2020api,
  author = {Warin, Thierry},
  title = {Virtual Campus: API : covidvirus},
  url = {https://virtualcampus.skemagloballab.io/posts/api-covidvirus/},
  year = {2020}
}