knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-",
  out.width = "100%",
  message = FALSE
)

Covid19US

The goal of Covid19US is to embed a newly created shiny application for exploring COVID-19 data in the United States of America (USA) within a package, and to refactor various parts of the application logic into R functions exported by the package.

Shiny application

As stated above, the shiny application was created using the R package, shiny, to allow users to explore COVID-19 related data in the continental United States of America. For both the total number of cases and total number of deaths, the following data visualizations are provided:

  1. A choropleth map displaying the spatial distribution of the total number of cases and deaths respectively, recorded at the state level.
  2. A timseries chart displaying the change in total cases and deaths recorded at the state level between the January'22 and the September'28 of 2020, compared to the national average number of cases and deaths respectively.
  3. An accompanying table recording the exact number of cases and deaths recorded at the state level, and the national average, over the same time frame.

For more information on the application itself and the data contained within it, please click here.

Installation

The development version of Covid19US can be installed directly from GitHub with:

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

Getting started

The application can then be launched using the following code:

library(Covid19US)

launch_app()

Package functions

This function was created and implemented within the select_input function in order to automatically select two different US states for comparison each time the application is launched. In addition, this function is used to create all adjustable inputs for the application.

set.seed(10)
library(Covid19US)

random_states(usa_state_map)

select_input("state", usa_state_map)

Secondly, on the server side, the function average_measure can be used to produce a summary count of either tot_cases or tot_death for COVID19 in the USA. This is used to construct the time series plot seen in the application.

library(dplyr)

#example <- average_measure(usa_covid_data, "tot_cases") %>%
#  arrange(-tot_cases) %>%
#  head(10)

#example

The final function, output_table, converts any data frame into a stylish and presentable table using the kableExtra package and can be seen alongside the time series chart in the application.

library(dplyr)

#usa_covid_data %>%
#  select(date, state, tot_cases)%>%
#  filter(state == "california") %>%
#  head(5) %>%
#output_table("cases", "Total cases in California per day")

Additional information

For more detailed instructions on how to use the package and the functions contained within it, please consult the vignette



etc5523-2020/r-package-assessment-AbhishekSinha28 documentation built on Jan. 1, 2021, 1:09 a.m.