16
SHINING WITH SHINY: INTRODUCING A WEB APPLICATION FRAMEWORK FOR R Gokul Bhandari

SHINING WITH SHINY: INTRODUCING A WEB APPLICATION FRAMEWORK FOR R Gokul Bhandari

Embed Size (px)

Citation preview

Page 1: SHINING WITH SHINY: INTRODUCING A WEB APPLICATION FRAMEWORK FOR R Gokul Bhandari

SHINING WITH SHINY: INTRODUCING A WEB APPLICATION FRAMEWORK FOR R

Gokul Bhandari

Page 2: 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

Page 3: SHINING WITH SHINY: INTRODUCING A WEB APPLICATION FRAMEWORK FOR R Gokul Bhandari

Deployment of shiny

Two ways: Shiny Server and shinyapps Shiny server: Open source and Professional

versions Through shinyapps: https://www.shinyapps.io/ Free, Basic $39/month, standard $99/month,

Professional $299/month

Page 4: SHINING WITH SHINY: INTRODUCING A WEB APPLICATION FRAMEWORK FOR R Gokul Bhandari

Example of shiny app

Page 5: SHINING WITH SHINY: INTRODUCING A WEB APPLICATION FRAMEWORK FOR R Gokul Bhandari

Code: ui.R

Page 6: SHINING WITH SHINY: INTRODUCING A WEB APPLICATION FRAMEWORK FOR R Gokul Bhandari

Code: server.R

Page 7: SHINING WITH SHINY: INTRODUCING A WEB APPLICATION FRAMEWORK FOR R Gokul Bhandari

Building user-interface (minimum code)

Page 8: SHINING WITH SHINY: INTRODUCING A WEB APPLICATION FRAMEWORK FOR R Gokul Bhandari

Building user-interface

Page 9: SHINING WITH SHINY: INTRODUCING A WEB APPLICATION FRAMEWORK FOR R Gokul Bhandari

Building user-interface

Page 10: SHINING WITH SHINY: INTRODUCING A WEB APPLICATION FRAMEWORK FOR R Gokul Bhandari

Adding control widgets

Page 11: SHINING WITH SHINY: INTRODUCING A WEB APPLICATION FRAMEWORK FOR R Gokul Bhandari

Adding control widgets

Page 12: SHINING WITH SHINY: INTRODUCING A WEB APPLICATION FRAMEWORK FOR R Gokul Bhandari

Displaying reactive output Output dynamically computed every time an

input changes Inputs are given through widgets Code updates the recent values of widgets

Page 13: SHINING WITH SHINY: INTRODUCING A WEB APPLICATION FRAMEWORK FOR R Gokul Bhandari

Output (ui) & render (server) functions

Page 14: SHINING WITH SHINY: INTRODUCING A WEB APPLICATION FRAMEWORK FOR R Gokul Bhandari

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

Page 15: SHINING WITH SHINY: INTRODUCING A WEB APPLICATION FRAMEWORK FOR R Gokul Bhandari

Shiny Layouts Sidebar Grid: Fluid Grid, Fixed Grid Tabsets Navlists Nabbar Pages Themes

Page 16: SHINING WITH SHINY: INTRODUCING A WEB APPLICATION FRAMEWORK FOR R Gokul Bhandari

Demonstration

https://gokul.shinyapps.io/AOLAnalyzer/ https://gokul.shinyapps.io/shinyDoc/stat1.

Rmd http://rpubs.com/gokul108