SHINING WITH SHINY: INTRODUCING A WEB APPLICATION FRAMEWORK FOR R Gokul Bhandari
What is Shiny? A web application framework for R developed by Rstudio R is open source statistical programming language Download R from r-project.org Download Rstudio (IDE) from rstudio.com R packages: shiny, shinyapps
Deployment of shiny Two ways: Shiny Server and shinyapps Shiny server: Open source and Professional versions Through shinyapps: Free, Basic $39/month, standard $99/month, Professional $299/month
Example of shiny app
Code: ui.R
Code: server.R
Building user-interface (minimum code)
Building user-interface
Adding control widgets
Displaying reactive output Output dynamically computed every time an input changes Inputs are given through widgets Code updates the recent values of widgets
Output (ui) & render (server) functions
Reactivity: Main points use an *Output function in the ui.R script to place reactive objects in your Shiny app use a render* function in the server.R script to tell Shiny how to build your objects surround R expressions by braces, { }, in each render* function save your render* expressions in the output list, with one entry for each reactive object in your app. create reactivity by including an input value in a render* expression
Shiny Layouts Sidebar Grid: Fluid Grid, Fixed Grid Tabsets Navlists Nabbar Pages Themes
Demonstration