knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-",
  out.width = "100%"
)
library(rmarkdown)
library(readr)
library(tidyverse)
library(lubridate)
library(ggplot2)
library(hrbrthemes)
library(plotly)
library(gridExtra)
library(dplyr)
library(COVID19CHN)

COVID19CHN

R build status

The goal of COVID19CHN is to help launching the shiny app with datasets and functions, which helps with basic analysis of COVID-19 daily cases of every province in China, including confirmed cases, death cases and recovered cases as of 30 September 2020.

Installation

You can install the development version of COVID19CHN from GitHub with:

# install.packages("devtools")
devtools::install_github("etc5523-2020/r-package-assessment-Lulu-Pi")

Example

This is a basic example which shows you what the package includes:

The dataset of COVID-19 daily cases in each province in China

library(tibble)
tibble(China_covid19)

The COVID-19 cases per month from January in China

library(kableExtra)
China_covid19 %>%
  select(-Lat, -Long, -Date) %>%
  group_by(Month,
          `Province/State`) %>%
  summarise(Confirmed = sum(Confirmed),
            Deaths = sum(Deaths),
            Recovered = sum(Recovered, na.rm = TRUE)) %>%
  head(10) %>%
  kable() %>%
  kable_styling(bootstrap_options = c("striped", "hover"))

COVID19 daily cases trend in some provinces or states China

China_covid19 %>% 
  filter(`Province/State` %in% c("Shanghai", "Beijing", "Hubei")) %>%
  pivot_longer(cols = c("Confirmed",
                      "Deaths",
                      "Recovered"),
             names_to = "Type",
             values_to = "Cases") %>% 
  group_by(Date, Type, `Province/State`) %>% 
  summarise(Cases = sum(Cases, na.rm = TRUE)) %>%
  ggplot(aes(x = Date, y = Cases, color = Type)) +
  geom_line() +
  facet_wrap(~`Province/State`, ncol = 1, scales = "free_y") +
  theme_bw()


etc5523-2020/r-package-assessment-Lulu-Pi documentation built on Jan. 1, 2021, 1:11 a.m.