Object not foundn in shiny app

Hi!

I have been trying David Robinson's Tidy Tuesday tutorials. I ran into problem while doing the 'Analyzing Global Yields in R'. I was trying to create a shiny app, but when I run the document it says "object yields_tidy not found". It runs perfectly well in my console though. Please help. Thank you un advance.

knitr::opts_chunk$set(echo = TRUE)

library(dplyr)
library(ggplot2)
library(forcats)
library(readr)
library(shiny)

yields_tidy <- readRDS("~/Desktop/R/crop-yields-shiny/yields_tidy.rds")

Inputs and Outputs

plot_yields<-function(tbl){
tbl %>%
mutate(crop = fct_reorder(crop, -yield)) %>%
ggplot(aes(year,yield, color = crop)) +
geom_line() +
facet_wrap(~entity) +
labs(x = "Year",
y ="Yield (tonnes per hectar)",
title="Crop yields in India over time",
color= "Crop")
}

yields_tidy %>%
filter(code %in% c("USA", "IND")) %>%
plot_yields()

inputPanel(
  selectizeInput("entity", 
                label = "Country/Continent/Region:",
                choices = unique(yields_tidy$entity), 
                selected = "United States of America"),
                multiple=TRUE
)


  
renderPlot({
  yields_tidy %>%
    filter(entity %in% input$entity) %>%
    plot_yields()
})

This topic was automatically closed 54 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.