scieee AI-readable full text Open interactive document viewer

Shinyscholar – a template for creating reproducible Shiny applications in R

Smart, Simon; Lucas, Tim

Abstract

Shiny is a framework for producing apps in R that is an increasingly popular method for academics to develop software. However a survey of apps published in 2023 found they typically fail to facilitate reproducible research or provide attribution to software developers.Additionally, academics often have little formal training in software development and consequently apps fail to adhere to best practices in structuring code and automated testing. To address these shortcomings, we present Shinyscholar (https://cran.r-project.org/package=shinyscholar) as a framework built upon Shiny which provides a suite of features tailored to the production of academic Shiny apps. Developed by forking WallaceEcoMod (an app for modelling species distributions with many desirable features) and the addition of extra features, Shinyscholar generates a template app structured as an R package where an analysis is broken down into steps with multiple options for each step. Analyses from generated apps can be saved and loaded at any point, a file can be downloaded that completely reproduces the analysis and developers of dependent software are appropriately cited. Other features include a flexible system for reporting messages to users, structures for providing user guidance, the ability to view source code from inside the application and a walk-through to guide new users. The visible structure of the app is reflected in the structure of the code, with each possible option in the analysis composed of a Shiny module that calls one function, facilitating maintenance and automated testing. The talk will explain how to create a new app and the workflow for developing modules. By using Shinyscholar, to create an app, developers can concentrate on creating domain-specific functionality rather than enabling communication between modules or designing user interfaces and will be more able to produce apps that follow best practices, are maintainable, and run reliably.Acknowledgements Shinyscholar was created by forking WallaceEcoMod and we are grateful for those developers for creating much of the functionality. Funding to develop Shinyscholar was provided by Wellcome.A recording of this session is available on YouTube: https://youtu.be/8YPXUE5qy_w

Full text

Shinyscholar A template for creating reproducible Shiny applications in R Simon Smart and Tim Lucas, School of Medical Sciences, University of Leicester 9th September 2025 1 Shinyscholar helps create reproducible analytical apps in R • Creates an empty application with a regular structure • Analyses can be reproduced outside the app 2 Shinyscholar helps create reproducible analytical apps in R • Creates an empty application with a regular structure • Analyses can be reproduced outside the app • Make it easier to follow so�ware development best practices • Developers can concentrate on creating functionality 3 R has cutting-edge statistical methods but barriers can restrict uptake • Know how to use R 4 R has cutting-edge statistical methods but barriers can restrict uptake • Know how to use R • Able to comprehend documentation 5 R has cutting-edge statistical methods but barriers can restrict uptake • Know how to use R • Able to comprehend documentation • Access to specific data 6 R has cutting-edge statistical methods but barriers can restrict uptake • Know how to use R • Able to comprehend documentation • Access to specific data • Format data in specific ways 7 Shiny apps enable anybody to access the power of R ui <- fluidPage( numericInput("number", "Enter a number", value = 5), textOutput("answer") ) server <- function(input, output) { output$answer <- renderText(input$number *10) } shinyApp(ui, server) 8 Shiny apps are becoming increasingly popular in academia • The low barrier to entry makes Shiny popular • Substantially increased apps as a method of dissemination 9 Reproducibility relies on each module calling one function Create the function: Use it in the module and store the input: transform_multiply <- function(number) number *10 common$result <- transform_multiply(input$number) common$meta$transform_multiply$number <- input$number 16 Reproducibility relies on each module calling one function Create the function: Use it in the module and store the input: In the Rmarkdown: transform_multiply <- function(number) number *10 common$result <- transform_multiply(input$number) common$meta$transform_multiply$number <- input$number result <- transform_multiply({{transform_multiply_number}}) 17 Reproducibility relies on each module calling one function Create the function: Use it in the module and store the input: In the Rmarkdown: metadata() takes care of a lot of the boring code transform_multiply <- function(number) number *10 common$result <- transform_multiply(input$number) common$meta$transform_multiply$number <- input$number result <- transform_multiply({{transform_multiply_number}}) 18 Disagapp for disaggregation regression 19 MetaInsight for network metaanalysis 20 Learn more • install.packages("shinyscholar") • Example app at https://simonsmart.shinyapps.io/ shinyscholar/ install.packages("shinyscholar", dependencies = TRUE) • README guide to development at https://simonsmart88.github.io/shinyscholar/ • Workshop for Ukraine 21 Acknowledgments • Wellcome for funding • Wallace developers especially Rob Anderson • Tim Lucas 22