Interactive web apps with R and Shiny

Lecture 27

Dr. Mine Çetinkaya-Rundel

Duke University
STA 199 - Fall 2023

2023-12-07

Announcements

  • Don’t forget to fill out the instructor and TA evaluations!

Shiny

Shiny

Shiny is an R package that makes it easy to build interactive web apps straight from R. You can host standalone apps on a webpage or embed them in R Markdown documents or build dashboards. You can also extend your Shiny apps with CSS themes, htmlwidgets, and JavaScript actions.

Shiny App


Server

+


Client / Browser

+ +

Anatomy of an App

library(shiny)

shinyApp(
  ui = list(),
  
  server = function(input, output, session) {
  
  }
)

Multi-row layout

A brief widget tour

rundel.shinyapps.io/widgets/

Live demo

Let’s make a weather app!

Go to https://github.com/sta199-f23-1/shiny-demo to follow along.