knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "man/figures/README-", out.width = "100%", message = FALSE )
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.
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:
For more information on the application itself and the data contained within it, please click here.
The development version of Covid19US can be installed directly from GitHub with:
# install.packages("devtools") devtools::install_github("etc5523-2020/r-package-assessment-AbhishekSinha28")
The application can then be launched using the following code:
library(Covid19US) launch_app()
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")
For more detailed instructions on how to use the package and the functions contained within it, please consult the vignette
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.