I am developing a shiny app and have two selectInput boxes. Both of them take the same inputs and I want to update the input boxes based on the other's selection.
Basically I want to remove the selected variable on one input box not available on the drop down of the other.
vars <- c("A", "B", "C", "D", "E", "F", "G", "H")
selectInput("v1", label = "Select Variable 1", choices = vars),
selectInput("v2", label = "Select Variable 2", choices = vars)
In the above example, if a user selects the option A as "V1", I want to remove A from the options available for v2, and vice versa. I have tried doing the following but not succeeded
observe({
updateSelectInput(session, "v1", choices = vars)
})
observe({
updateSelectInput(session, "v2", choices = vars)
})