Skip to content
R for the Rest of Us Logo

If the video is not playing correctly, you can watch it in a new window

Transcript

Click on the transcript to go to that point in the video. Please note that transcripts are auto generated and may contain minor inaccuracies.

Your Turn

Take a look at quarto/assignment_01/base_quarto_app.qmd. What parts were moved where? Where is the UI code and where is the server code?

Click "Run Document" and try the app out. What files were generated when you ran the document?

Try changing the order of the code blocks. Does order matter?

Learn More

To learn more about using Shiny with Quarto, check out the Quarto website.

Have any questions? Put them below and we will help you out!

You need to be signed-in to comment on this post. Login.

Another issue with the assignment. The Assignment 1 app doesn't contain a "server" code block at all, so the plot does not appear until I add one manually.

David Keyes

David Keyes Founder

April 17, 2024

Sorry about that! I'll have this updated very soon.

David Keyes

David Keyes Founder

April 17, 2024

Ok, just fixed the code on GitHub. I've also pasted it below for you.

---
title: "Movie App"
format: html
server: shiny
---


```{r}
#| context: setup
#| message: false
#| echo: false
library(shiny)
library(tidyverse)
library(fivethirtyeight)

##load the biopics data
data(biopics)
biopics <- biopics %>% filter(!is.na(box_office))
```


```{r}
sliderInput("year_filter", 
      "Select Highest Year", 
      min = 1915,
      max=2014, 
      value = 2014)

plotOutput("movie_plot")
```

```{r}
#| context: server

biopics_filtered <- reactive({
  req(input$year_filter)
  biopics %>%
    filter(year_release < input$year_filter)
})

output$movie_plot <- renderPlot({
  
  ggplot(biopics_filtered()) +
    aes(y=box_office, x=year_release, color=type_of_subject) + 
    geom_point()
})
```