knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "man/figures/README-", out.width = "100%", message=FALSE, warning=FALSE )
The coronavirus package provides a tidy format dataset of the 2019 Novel Coronavirus COVID-19 (2019-nCoV) epidemic. The raw data pulled from the Johns Hopkins University Center for Systems Science and Engineering (JHU CCSE) Coronavirus repository.
More details available here, and a csv
format of the package dataset available here
A summary dashboard is available here
As this an ongoing situation, frequent changes in the data format may occur, please visit the package news to get updates about those changes
Install the CRAN version:
install.packages("coronavirus")
Install the Github version (refreshed on a daily bases):
# install.packages("devtools") devtools::install_github("RamiKrispin/coronavirus")
While the coronavirus CRAN version is updated every month or two, the Github (Dev) version is updated on a daily bases. The update_dataset
function enables to overcome this gap and keep the installed version with the most recent data available on the Github version:
library(coronavirus) update_dataset()
Note: must restart the R session to have the updates available
data("coronavirus")
This coronavirus
dataset has the following fields:
head(coronavirus) tail(coronavirus)
Here is an example of a summary total cases by region and type (top 20):
library(dplyr) summary_df <- coronavirus %>% group_by(Country.Region, type) %>% summarise(total_cases = sum(cases)) %>% arrange(-total_cases) summary_df %>% head(20)
Summary of new cases during the past 24 hours by country and type (as of r max(coronavirus$date)
):
library(tidyr) coronavirus %>% filter(date == max(date)) %>% select(country = Country.Region, type, cases) %>% group_by(country, type) %>% summarise(total_cases = sum(cases)) %>% pivot_wider(names_from = type, values_from = total_cases) %>% arrange(-confirmed)
The raw data pulled and arranged by the Johns Hopkins University Center for Systems Science and Engineering (JHU CCSE) from the following resources:
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.