Shiny Web Apps
What is Shiny?
Shiny is an R-based environment for building interactive web applications for data analysis and exploration (“Shiny - Tutorial,” n.d.; Chang et al. 2023). Since most JavaScript code is autogenerated by the environment, basic R knowledge is sufficient for developing Shiny apps. They can be deployed on local computers or web servers including custom and cloud-based servers (e.g. AWS, GCP, shinyapp.io service). The basic structure of a Shiny app is an app.R script containing the following components:
Step 1. User interface
- Server function
- Statement to run shiny app
Alternatively, the ui and server functions can be organized in two script files, a ui.R and a server.R script, respectively.
Develop and test Shiny app locally
Open R and set session to parent directory (here myappdir) containing shiny script app.R, and the run it with the runApp() function. A sample app.R script for testing can be downloaded from here.
This will open the app in a web browser.
Deploy on web server
This can be done on local or cloud systems. An easy solution is to get an account on shinyapps.io and then deploy Shiny apps there. For details, see here.
Example Shiny app
The following Shiny app is hosted on shinyapps.io (here Instructor account) and embedded into the markdown (or html) source of this page using the following iframe syntax:
Another example from Nick Harding using Shiny App: volcanoshiny
Additional examples
- Volcano Plots: VolcaNoseR (publication).
- systemPipeShiny: web demo and Bioc package
- spatialHeatmap: web demo
Learning Shiny
The Shiny section on the Rstudio site contains excellent tutorials. In addition, users may want to explore the example apps included in the shiny package. This can be done by loading the individual examples (see here) or saving the code to a user writable directory like this:
Resources to learn Shiny
Tutorial and books
- Long video tutorials.
- Shiny official Lessons.
- Shiny official gallery and source code
- Advanced Shiny book - Mastering Shiny
- Advanced web application in R book - Javascript for R
- Shiny Tutorial by Le Zhang (UCR) - Shiny Tutorial
Extension packages
- Catalog of cool extension packages - Awesome Shiny
- shinyWidgets - UI components
- systemPipeShiny - A framework for workflow management and data visualization.
- spsComps - UI components, animations, server components
- shinyjs - server end JavaScript communications
Session Info
R version 4.5.1 (2025-06-13)
Platform: x86_64-pc-linux-gnu
Running under: Debian GNU/Linux 11 (bullseye)
Matrix products: default
BLAS: /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.9.0
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.9.0 LAPACK version 3.9.0
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8 LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 LC_PAPER=en_US.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
time zone: America/Los_Angeles
tzcode source: system (glibc)
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] fgsea_1.36.0 ggplot2_4.0.1
loaded via a namespace (and not attached):
[1] Matrix_1.7-4 gtable_0.3.6 jsonlite_2.0.0 dplyr_1.1.4 compiler_4.5.1 tidyselect_1.2.1 Rcpp_1.1.0 parallel_4.5.1 dichromat_2.0-0.1 scales_1.4.0
[11] BiocParallel_1.44.0 yaml_2.3.12 fastmap_1.2.0 lattice_0.22-7 R6_2.6.1 generics_0.1.4 knitr_1.51 htmlwidgets_1.6.4 tibble_3.3.0 pillar_1.11.1
[21] RColorBrewer_1.1-3 rlang_1.1.6 fastmatch_1.1-6 xfun_0.55 S7_0.2.1 otel_0.2.0 cli_3.6.5 withr_3.0.2 magrittr_2.0.4 digest_0.6.39
[31] grid_4.5.1 cowplot_1.2.0 lifecycle_1.0.4 vctrs_0.6.5 data.table_1.18.0 evaluate_1.0.5 glue_1.8.0 farver_2.1.2 codetools_0.2-20 rmarkdown_2.30
[41] tools_4.5.1 pkgconfig_2.0.3 htmltools_0.5.9