knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)

The Coronavirus Dataset

The {covidvirus} package comes with one function get_cases() that retrieves a daily snapshot of confirmed, death, and recovered cases from the Johns Hopkins University Center for Systems Science and Engineering (JHU CCSE) Coronavirus repository.

library(covidvirus)
corona_virus <- covidvirus::get_cases()

The retrieved data consists of the following columns:

The returned dataset is a tibble and we can easily leverage any tidyverse compatible function.

Let's take a look at the first few rows and the structure:

head(corona_virus)
dplyr::glimpse(corona_virus)

Brief Analysis

Let's dive a bit into the data. We'll use the following libraries: dplyr.

library(dplyr)

Total cases by Type

corona_virus %>%
  group_by(type) %>%
  summarize(
    total_cases = sum(cases)
  ) %>%
  ungroup()

Total cases by each country/region

corona_virus %>%
  group_by(country_region) %>%
  summarize(
    total_cases = sum(cases)
  ) %>%
  ungroup() %>%
  arrange(desc(total_cases))


nikdata/covidvirus documentation built on April 2, 2020, 4:06 a.m.