Can I update/ change the value that kept in the reactive? For instance,
x <- reactive({
isolate(input$site1)
})
# Inpsect values from ui.R.
output$test <- renderText({
# Take a dependency on input$goButton
input$goPlot # Re-run when button is clicked
site1 <- isolate(input$site1)
if(site1 == x()){
site1
} else {
paste(x(), site1)
x() <- site1 // this not working obviously.
}
})
Any ideas?
The reason I want to do so because I want to store the previous input data input$site1
when the user click the button input$goPlot
and I want to make sure the use select different option when they click the button again. If they select the same data or do not select any other option and click the button, then I don't want the app to do anything. Hope that makes sense.
What you want is probably not a reactive expression but reactive values:
shinyServer(function(input, output, session) {
values <- reactiveValues(x="someValue")
output$test <- renderText({
...
if(site1 == isolate(values$x)) {
...
} else {
...
values$x <- site1
}
})
})
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With