Taking Your R Shiny Apps to the Next Level
The Ecological Forecasting Initiative & Ecological Society of America Statistical Ecology Section hosted a seminar series of four presentations to demonstrate a variety of technical aspects for R Shiny web app development. Attendees gained insights into the addition of key technical features that can be used to augment Shiny apps. Example R code that incorporates these features in a Shiny app are available on the EFI GitHub repo.
The topics covered were:
- Visualization of Data in Space and Time: An Interactive Framework
- Creative Visualization of Model Results and Uncertainty in Shiny
- Improving Speed of Shiny Apps by Pre-Computing Models
- A Primer to Creating Interactive Maps with Leaflet in Shiny
Resources from the presentations including links to recordings and R resources from the presentations are below.
Calls were 1 hour in length with the call organizers staying on an extra 30-60 minutes to help individuals with questions and troubleshooting. Speakers spent the first 15 min of the webinar presenting an app that they developed, which includes the technical aspect of interest. The remaining 45 minutes were used to share a “bare-bones” Shiny app that specifically focuses on the key technical feature that was the topic of the given webinar. The speaker demonstrated the components of the feature and guided attendees in applying this feature in the example R code as well as its potential use in other Shiny apps.
Visualization of Data in Space and Time: An Interactive Framework
Josh Cullen (University of Florida), August 10, 2021
- Video from Josh’s presentation: https://youtu.be/b3rYfG5Ai7c
- Block, et al. 2011. Tracking apex marine predator movements in a dynamic ocean. Nature, 475(7354), 86-90.
- Wauchope, et al. 2021. Evaluating impact using time-series data. Trends in Ecology & Evolution, 36(3), 196-205.
- Josh’s Shiny app: https://joshcullen.shinyapps.io/segmentation_of_NSD
- Vignette that provides a step-by-step guide to dynamically explore temporal patterns in animal tracks using a built-in Shiny app in the bayesmove package
- GitHub repo with Josh’s presentation and example code
Josh is a postdoc at the University of Florida developing Bayesian methods to infer animal movement patterns and resource selection from biotelemetry data. Additionally, he is assessing the impacts of climate change on the population viability of an endangered raptor species. Josh is interested in the development of Shiny apps for exploratory data analysis and to serve as decision-support tools.
Creative Visualization of Model Results and Uncertainty in Shiny
Margaret Siple (NOAA-AFSC), August 17, 2021
- Video from Margaret’s presentation: https://youtu.be/hzuDmlFShv8
- Howe et al. 2019. Acknowledging uncertainty impacts public acceptance of climate scientists’ predictions. Nature Climate Change, 9(11), 863–867. https://doi.org/10.1038/s41558-019-0587-5
- Margaret’s Shiny app: https://msiple.shinyapps.io/mammaltool/
- Data visualization options for explaining uncertainty
- Smith et al. 2021. Comparing Dynamic and Static Time-Area Closures for Bycatch Mitigation: A Management Strategy Evaluation of a Swordfish Fishery. Frontiers in Marine Science, 8, 272.
- Plagányi, et al. 2013. Integrating indigenous livelihood and lifestyle objectives in managing a natural resource. Proceedings of the National Academy of Sciences, 110(9), 3639–3644. https://doi.org/10.1073/pnas.1217822110
- NEFSC Atlantic Herring Fishery Management Plan, 2019
- Amanda Hart’s package for decision table: https://github.com/ahart1/decisiontable
- Guideline for user testing from 18F Methods: https://methods.18f.gov/validate/usability-testing/
- Making your Shiny App accessible: https://cyberhelp.sesync.org/blog/shiny-accessibility.html
- NOAA 508 List: https://libguides.library.noaa.gov/Section508/CreatingDocs
- Code that Margaret shared during the presentation and additional resources for the following topics can be found at the end of Margaret’s slides here in the GitHub repo for this seminar series
- Useful guides for different phases of Shiny Development, displaying data, saving data, building a package for an app and vice versa, and testing
Margaret is a Research Fish Biologist at NOAA’s Alaska Fisheries Science Center. She is broadly interested in how ecological information is incorporated in the models and tools we use for fisheries management. Her most recent work with the Ocean Modeling Forum at the University of Washington has been in developing tools to communicate risk to stakeholders.
Improving Speed of Shiny Apps by Pre-Computing Models
Kok Ben Toh (Northwestern University), August 31, 2021
- Video from Ben’s presentation: https://youtu.be/O_R42SWrJ34
- Ben’s slides: https://bit.ly/shiny831
- Ben’s Shiny app that allows users to explore the relationship between access to healthcare and malaria prevalence using the Bunkpurugu-Yunyoo district in Northern Ghana as a case, http://bit.ly/ben-hf-app
- Efficient R Programming (Gillespie & Lovelace)
- Demo 1 R script can be downloaded here
- Demo 2 R script can be downloaded here
- Demo 3 R script can be downloaded here
- Yang et al. 2021. Modelling distributions of Aedes aegypti and Aedes albopictus using climate, host density and interspecies competition. PLoS Neglected Tropical Diseases 15(3): e0009063. https://doi.org/10.1371/journal.pntd.0009063
- Profiling a Shiny app: https://rstudio.github.io/profvis/ (suggestion that came in from the group during the Q&A)
Ben is currently a postdoc at Northwestern University focusing on malaria and COVID-19 modeling. He graduated with a PhD in interdisciplinary ecology from University of Florida in December 2020. His research interests include tackling environmental and infectious disease problems with statistical and mathematical models and using interactive visualizer or simulator to effectively communicate models to a general audience. He considers himself an R enthusiast and he loves learning and teaching scientific computing.
A Primer to Creating Interactive Maps with Leaflet in Shiny
Thomas Connor (University of California, Berkeley), September 14, 2021
- Video from Thomas’ presentation: https://youtu.be/f2sBa69kq3s
- Toweil, D. E., and J. W. Thomas. 2002. North American Elk, Ecology and Management. Smithsonian Institution Press, Washington, D. C., USA.
- Higgins, K. F. 1986. Interpretation and compendium of historical fire accounts in the northern Great Plains (Vol. 161). US Department of the Interior, Fish and Wildlife Service.
- GitHub repo with Thomas’ presentation and example code
- Introductory exercises and documents to learn Leaflet: https://rstudio.github.io/leaflet
- Course material from a previous Shiny class that Thomas participated in and mentioned during his talk
Thomas is an ecologist with a broad interest in how environmental and anthropogenic factors affect wildlife habitat, population dynamics, and genetic connectivity. Recently, Thomas has been working with the Karuk Tribe in Northern California to better understand how traditional prescribed burning practices affect Roosevelt elk populations.