Wrap-up + Shiny

Lecture 25

Dr. Mine Çetinkaya-Rundel

Duke University
STA 199 - Spring 2024

2024-04-23

Warm up

While you wait for class to begin…

Take the time to fill out course and TA evaluations!

Want to nominate a TA as “TA of the Year”? Send an email to dus@stat.duke.edu with your nomination.

AE 19 - Last one!

  • Go to your ae repo, and pull.

  • Make a change, any change, to ae-19-last-ae.qmd. render, commit, and push.

Announcements

  • Finalize (render, commit, push) by 8 am tomorrow (Wednesday) morning

  • Fill out last peer evaluations by Sunday

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(
    # new (to you) widgets go here
  ),
  
  server = function(input, output, session) {
    # somewhat familiat (to you) code goes here
  }
)

A brief widget tour

rundel.shinyapps.io/widgets/

Live demo

Let’s make a weather app!

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

Note

If you want to code along, click on the “Use this template” button to create a copy of this repo for yourself, clone it in RStudio, and code along as usual.