Shiny applications and dashboards help communicate analytics insights to both technical and non-technical audiences in an interactive and efficient way. However, debugging them is not an easy process. For 2020 October virtual meetup, 30+ data enthusiastics joined the interactive workshop led by R-Ladies Philly member Jake Riley. Jake elucidated aspects of the popular dashboard building package flexdashboard and demonstrated his recently published tool shinyobjects to debug.
flexdashboard and reactivity
flexdashboard leverages Rmarkdown and shiny to build a dashboard or shiny application. Instead of splitting ui and server functions, flexdashboard takes the advantage of interpretability from Rmarkdown and makes shiny code cleaner and easier to read.
Like shiny, flexdashboard used the reactive programming model which involves user inputs and dynamic data/plots/titles. It can get really complicated when you have a cascade of reactive variables. It also increases the difficulty at the debugging step.
To troubleshoot reactive data, Jake developed shinyobjects. This R package can access reactive objects in your local environment and allow debugging R code without actually running the app. It will save you time and allow you to iterate more quickly.
Do you also hate having to run the entire shiny code to see what one tiny change will look like? There's a tool you can use to debug specific sections! Check out shinyobjects by @yake_84! #RStats pic.twitter.com/XNs1fi3BGr— R-Ladies Philly (@RLadiesPhilly) October 21, 2020
The package includes 4 components at the workflow
view_ui()to see what UI components look like without running the app
load_reactive_objects()to convert reactive objects to static functions
- create a dummy input list object for users to prepopulate
convert_selection()to convert code highlighted in source pane