Hello!
In my Shiny app, the user hits an action button (input$run) and that initiates the following section on server side:
main_reactive <- reactiveValues()
observeEvent(input$run, {
...
a lot of different calculations ...
main_reactive$forplot = mydataframe
})
Once the calculations in this observeEvent are finished, I'd like to generate a plot:
output$my_plot <- renderPlot({ use the output main_reactive$forplot })
However, Shiny attempts to build a plot immediately. Even if I start inside renderPlot with this:
output$my_plot<- renderPlot({
if (input$run == 0) return(NULL)
input$run
isolate(print(ggplot(...))
It's still not working - because until my observeEvent is finished calculating, there is nothing for the renderPlot to use. How could I make renderPlot wait for the results of my observeEvent - until my reactive values are available?
Thank you very much!