Building a Shiny app
Megumi Oshima & Nicholas Ducharme-Barth
January 2025
Shiny is a package that can be used to build interactive web apps in either R or Python.
All Shiny apps need three components:
ui.R
): this is the interactive partserver.R
): this is the computation/plotting engineshiny::shinyApp()
(app.R
): this ties everything together and launches the appLet’s look closer at an example.
If the ui.R
and server.R
are defined as separate scripts running the app is straightforward.
Package all code and data in the same directory, this will make publishing the app easier.
Once your app is built it can hosted online via shinyapps.io (individuals) or Posit Connect (enterprise users).
In both cases, publishing can be done in a couple steps using the rsconnect
R package.
rsconnect::deployApp(appDir = '<project-dir>')
!Play with the AI assistant for Shiny and Shiny live to add some new features to the existing app 02-shiny-example-vb-curve.r
.
ISC Open Science Worflows Workshop 2025