I have a very large app. To help it load more efficiently, I have put a lot of the data processing into an observeEvent() function. What I am hoping to add is a slider input to change bin size on a histogram with reactive values.
How can I make the plot update without having to hit the action button again?
Here is a sample app:
library(shiny)
library(ggplot2)
ui <- basicPage(
actionButton("launch", "Launch"),
uiOutput("plotInteractive")
)
server <- function(input, output) {
bins <- reactive({input$binsize})
observeEvent(input$launch, {
plot <- ggplot(diamonds, aes(y = carat)) +
geom_histogram(bins = bins())
output$plotInteractive <- renderUI ({
tagList(
renderPlot(plot),
sliderInput(inputId = "binsize", label = "Bin Size", min = 1, max = 40, value = 20)
)
}) #end UI
}) #end observe
} #end server
shinyApp(ui, server)