Shiny Apps

This topic aims to provide you with a foundation for making a shiny app. From this topic, students are anticipated to be able to:

  • develop the user interface of a shiny app from scratch,
  • develop interactivity using widgets in a shiny app,
  • deploy a shiny app to shinyapps.io,
  • create interactive Shiny R Markdown documents (embed shiny features within an Rmd file).

And possibly:

  • Make an interactive plot with plotly
  • Make an interactive data table with the DT package

Resources

Video lecture:

Written material:

Regarding specific tasks:

Other dashboard tools besides shiny (but not in R):

  • With python: plotly dash. Check out the main website, or this Medium post introducing the tool.
  • With javascript: D3, a tremendously powerful tool with a steep learning curve (esp. if you don’t know javascript).

Test Your Understanding

  1. True or False: A shiny app, as a website, still requires an instance of R running in the background. The stat545.stat.ubc.ca website is static: it doesn’t require an active session to be running in the background.

  2. True or False: Although it’s important to document both a shiny app and an R package, documentation is more important in R packages compared to shiny apps.

  3. True or False: The following code ordinarily has y as 15, but using shiny::reactive() in a shiny app can have y equal 11.

    x <- 10
    y <- x + 5
    x <- 1
  4. True or False: Since shiny’s UI is html, we can manually write the UI by writing HTML in the HTML() function.

Agenda

We are going to be working off of a slide deck and tutorial written by Dean Attali. This should take two classes.