R-Package Review 📦
Overview 👏
In this blog post I will be reviewing Mayunk Bharadwaj’s R package ozcovid
made for Assignment 2 of ETC5523 containing coronavirus data, functions, and shiny application. The development version from GitHub.
The goal of ozcovid is help user to explore Australia’s coronavirus data through the interactive Shiny application ‘Coronavirus in Australia’ and the dataset oz_covid_data
. The package also contains three functions:
launch_app()
:The function allows the user to interact with Australia’s coronavirus data by launching the shiny dashboard ’Coronavirus In Australia’.
stateSelectInput()
:This function aims to select the state/territory of choice within the shiny app to generate a graph of confirmed coronavirus cases over time. This function generated from the ui components of the Shiny application
vicEventRenderText()
:This function generates a sentence describing the date and number of deaths in Victoria related to coronavirus on that date by asking the user to click on any point on the Victorian coronavirus-related deaths graphic. This function generated from the server components of the Shiny application.
What did I think this package would do? Did it do it? 📸
At the onset of viewing the GitHub page, the readme file, and pkgdown page using pkgdown::built_site()
function in Rstudio, these materials gave a clear picture of the package. All the functions and data set inside the ozcovid
package are relative to coronavirus in Australia.
The launch_app()
function is the centerpiece of the package. I can follow the steps in the readme file to run the shiny app. When executed, the function will return a Shiny application entitled ‘Coronavirus in Australia’. There are three main sections of the application:
- Confirmed Cases by state: a simple line plot was displaying confirmed coronavirus cases by the state over time (Refer to Figure 1).

Figure 1: the line plot in Shiny Dashboard
- Coronavirus Summary Table: a table that displays daily and cumulative coronavirus confirmed cases, deaths, and recoveries by date (Refer to Figure 2).

Figure 2: the table in Shiny Dashboard
- Deaths In Victoria: an interactive bar chart of Victoria’s coronavirus-related deaths (Refer to Figure 3).

Figure 3: the bar chart in Shiny Dashboard
In this shiny application, users have the ability to manually select or click the graph to achieve interactively and help users get an idea about the development of the pandemic.
Furthermore, as described in the help file and vignette, I successfully used the oz_covid_data()
function to obtain the data in the application. Two functions stateSelectInput()
and vicEventRenderText()
may assist other users in generating their shiny application.
Suggestions and Improvement 📖
Are the improvements that could be made to the code? 🤚
I think the code is well-written, and gives a concise and easy to understand documentation. However, I have two suggestions based on your code.
First of all, add some arguments to your function. If a function without any argument when executed, it will generate some limitations, such as the function is not reproducible or meaningless. The existing two functions could only use in your shiny application, so there is no need to include an argument within the function. I would suggest adding a new function based on your repeating menu icon in the dashboard.
@export
add_menu <- function(id, text_name, icon_name){
shinydashboard::menuItem(id, tabName = text_name, icon = icon(icon_name))
}
This function aims to add menu bar in the shiny dashboard. It contains three arguments: sidebar menu which be used for a Shiny input value, the name of a tab that this menu item will activate and the available icons.
In addition, the function with several arguments will be more complicated. You could add an example to tell users how to use this function.
Here is an example:
@examples
add_menu("Confirmed Cases by State", "dashboard", "dashboard")
Are there improvements that could be made to the shiny app inside the package? 💭
This shiny dashboard is very impressive and I really like how interactive it is. This shiny dashboard provided a more structured format instead of the complex shiny format. Some complexity shiny format would be easy for the end user’s eye to stray and become confused by several plots on the same page. It generates a number of informative plots such as the line chart and the bar chart, and I was able to learn a lot about the state of coronavirus in Australia.
I think the improvement that I would recommend would be the aesthetics of the application could have been better. Being able to communicate data stylishly and beautifully is as important as the data analysis itself, in my opinion. Specifically, I think the use of sliderInput and valueBoxes might have made the application pop a bit more.
Furthermore, this shiny dashboard could improve the application by using more complex and varied user input options. For example, you could add checkboxGroupInput where user is able to select multiple states. Or perhaps in the fourth section called ‘Deaths in Victoria’, adding a date range input so the user can obtain more specific information about arbitrary time periods (as opposed to a single day).
Is the documentation sufficient to get started? 🤔
The documentation in the README file is a bit simpler, which only contains how to install packages and the example of the data set. I would recommend that provide a detailed overview of the package, such as display the data set in the form of a simple graph or give some screenshots of this well structured shiny dashboard.
The functions is well documented, however, my recommendation would be to provide additional information in oz_covid_data
documentation. Specifically, in interpreting each variable, the format can be more standardized. You could follow the following code to make your documentation more profession.
\describe{
\item{date}{the date on a particular day}
\item{Daily Confirmed}{the daily confirmed coronavirus cases in Australia on that given date}
\item{...}{...}
}
Learned from reviewing the package ✍️
I understand that making a r package is an ideal way to package and distribute R code and data for re-use by others. It is not only creating functions but also debugging, testing and documentation. Good documentation can help users know how to use this package which is helpful for promoting the package.
Mayunk also documented his whole package when I type ?ozcocid
in the console, which includes a big picture of the package and his personal information. This part is missing in my package.
I also learned that I can add expect_silent()
to test the functions I created. This testing method is checking that the code produces no output, messages, or warnings.
Summary
Overall, Mayunk’s package and the shiny dashboard provided an interesting and insightful take on the state of coronavirus in Australia. Although the whole package is simple, there is no error or warning inside the package.
Well Done 👍!
I think the aesthetics of the package could have been better (e.g., give some arguments to the function) and improve the application by using more complex and varied user input options in the shiny dashboard.
Appendix
Documentation
The package includes all the following forms of documentation:
- The Installation instructions: for the package is found in README
- The Vignette(s) demonstrating major functionality that runs successfully locally
- The Function Documentation: for all exported functions in R help
- The Examples for all exported functions in R Help that run successfully locally.
Acknowledgements
One package used in this post is knitr
(Xie 2014).
Thanks for (Bharadwaj 2020) created the package.
References
Bharadwaj, Mayunk. 2020. “Ozcovid.” GitHub Repository. https://github.com/etc5523-2020/r-package-assessment-mayunk264; GitHub.
Xie, Yihui. 2014. “Knitr: A Comprehensive Tool for Reproducible Research in R.” In Implementing Reproducible Computational Research, edited by Victoria Stodden, Friedrich Leisch, and Roger D. Peng. Chapman; Hall/CRC. http://www.crcpress.com/product/isbn/9781466561595.