A Simple Modularized Shiny App

A Shiny module is a piece of code that is included as part of a larger Shiny app. I wrote this small Shiny app as I could not find a really simple example elsewhere. It is based on the “Hello Shiny” example that comes with the Shiny package. You can run it with:

library(shiny)
runExample("01_hello")

Hello Shiny is a simple application that uses the sidebarLayout, with a sliderInput in the sidebarPanel and a histogram displayed in the mainPanel. My Shiny app modularizes the sidebarPanel part of the sidebarLayout.

You can see it in action here: https://xplor.shinyapps.io/module_example_1

The code is available here: https://github.com/samuel-bohman/module_example_1

Comment below if this was helpful to you.

Cheers!

Update!

Added a second version of modularized “Hello Shiny” that uses renderUI in the module that switches between two sliderInput functions.

You can see it in action here: https://xplor.shinyapps.io/module_example_2/

The code is available here: https://github.com/samuel-bohman/module_example_2

VN:F [1.9.22_1171]
Rating: 0.0/5 (0 votes cast)
Share and Enjoy
  • Facebook
  • Twitter
  • LinkedIn
  • del.icio.us
  • StumbleUpon
  • RSS
  • email
  • PDF

Published by

Samuel

Ph.D. Student in the Department of Computer and Systems Sciences, Stockholm University.

Leave a Reply

Your email address will not be published.

*