My app takes a long time to calculate, so on the first load, I would like shiny to use default data saved as a csv file. I would, however, like users to be able to update this data (and the resulting plots) by pushing an action button. I have tried a few configurations. Here is what a simplified version looks like with observeEvent.
server.R
default_data <- read.csv("./default_data.csv")
function(input, output) {
# Load default
data <- reactive(default_data)
# I wish this could get it to update
observeEvent(input$goButton, {
data <- rnorm(100, input$recid_rate)
})
# Plot
output$plot <- renderPlot({
hist(data())
})
}
I have it to where the default data loads and is visulized in ggplot. But action buttons do not seem to override the default data. Thanks in advance for your thoughts!