Hi all,
I'm new to Shiny and I'm trying to recreate/ understand the Data explorer tab 'SuperZip example' on rstudio website (https://shiny.rstudio.com/gallery/superzip-example.html).
Can anyone walk me through what the following server.R code is doing? I'm attempting to make my own selectInput() widgets that respond to each other by filtering available selections, similar to the relationship between "States" and "Cities" in the 'SuperZip example' above.
observe({
cities <- if (is.null(input$states)) character(0) else {
filter(cleantable, State %in% input$states) %>%
`$`('City') %>%
unique() %>%
sort()
}
stillSelected <- isolate(input$cities[input$cities %in% cities])
updateSelectInput(session, "cities", choices = cities,
selected = stillSelected)
})
Thanks in advance!
Alex