Shiny (web framework) explained

shiny
Shiny
Logo Upright:yes
Author:Joe Cheng
Developer:RStudio Inc. (and current renamed company Posit PBC)
Latest Release Version:1.9.1[1]
Programming Language:R / Python
License:MIT License

Shiny is a web framework for developing web applications (apps), originally in R and since 2022 in python. It is free and open source.[2] It was announced by Joe Cheng, CTO of Posit, formerly RStudio, in 2012. One of the uses of Shiny has been in fast prototyping.[3]

In 2022, a separate implementation Shiny for Python was announced.[4] It is not meant to be a replacement, whereby both implementations will be developed concurrently and may never have all the features of each other. There is also Shinylive that allows running Shiny on the client (i.e., program code does not run on the server, reducing server load to just serving the code itself).[5]

Features

Shiny creates a reactive context wherein the user specifies, through input variables, the circumstances under which computations are re-executed, or graphs (often visualizations) re-rendered; this occurs almost instantaneously. The input variables are evaluated via a user interface which allows the simple creation of widgets such as text boxes, radio buttons, and drop-down lists.[6] [7]

There are two main parts to a Shiny file, which may alternatively be stored in two separate files. One is designed to accommodate the user interface, the appearance of which is restricted by the default choices, though can be extended through various other R packages. The other is designed to accommodate the server computations and plot generating code, for which all the built-in facilities of R are available.[6]

Examples

This is an example of a basic application in R where:[8]

library(shiny)

ui <- fluidPage(textInput("name", "What is your name?"), textOutput("greeting"))

server <- function(input, output, session)

shinyApp(ui, server)

And the equivalent application written in python:[9]

from shiny import App, reactive, render, ui

app_ui = ui.page_fluid(ui.input_text("name", "What is your name?"), ui.output_text("greeting"),)

def server(input, output, session):

@render.text def greeting: return f"Hello "

app = App(app_ui, server)

And shiny express for python:[10] from shiny.express import input, render, ui

ui.input_text("name", "What is your name?")

@render.textdef greeting: return f"Hello "

Deploying / Hosting Shiny

Deploying Shiny (R) can be achieved through several popular methods:

External links

Notes and References

  1. Web site: Shiny: Web Application Framework for R. 1 August 2024.
  2. Doi . Jimmy . Potter . Gail . Wong . Jimmy . Alcaraz . Irvin . Chi . Peter . Web Application Teaching Tools for Statistics Using R and Shiny . Technology Innovations in Statistics Education . 2016 . 9 . 1 . 10.5070/T591027492. free .
  3. Yu . Li. 2020 . Towards fast prototyping of cloud-based environmental decision support systems for environmental scientists using R Shiny and Docker . . 132 . 104797. 10.1016/j.envsoft.2020.104797. 221823072. 20.500.11850/431312 . free .
  4. Web site: Machlis . Sharon . 2022-07-27 . RStudio unveils Shiny for Python . 2024-05-17 . InfoWorld . en.
  5. Web site: Shiny for Python - Shinylive: Shiny + WebAssembly . 2023-01-30 . shiny.rstudio.com.
  6. Kasprzak . Peter . Mitchell . Lachlan . Kravchuk . Olena . Timmins . Andy. 2020 . Six Years of Shiny in Research - Collaborative Development of Web Tools in R . . 12 . 2 . 20–42. 10.32614/RJ-2021-004. 231709443 . 12 March 2022.
  7. Kaufman . Aaron R. . Implementing novel, flexible, and powerful survey designs in R Shiny . PLOS ONE . 30 April 2020 . 15 . 4 . e0232424 . 10.1371/journal.pone.0232424. 32353057 . 7192460 . 2020PLoSO..1532424K . free .
  8. Book: Wickham . Hadley . Mastering Shiny . 25 October 2024 . en . Your first Shiny app.
  9. Web site: Shiny for Python - Express vs. Core . 28 October 2024 . en.
  10. Web site: Shiny for Python - Overview . 25 October 2024 . en.
  11. Web site: Posit . 2024-11-01 . Posit . en.
  12. Web site: shinyapps.io . 2022-05-24 . www.shinyapps.io.