I have a Shiny App that generates multiple plots based on a selected filter, for each plot in the Server part I filter the data based on the selected Input filter:
output$plot_1 <- renderPlot({
df <- df %>% filter(df$filter == input$age)
#plot code here
})
output$plot_2 <- renderPlot({
df <- df %>% filter(df$filter == input$age)
#plot code here
})
I have to do this (filter the df inside the renderPLot function) for ALL plots. Is it possible to do it outside of renderPlot so that filtered df is available for all plots?