R Shiny selectInput that is dependent on another selectInput
You can't access inputs in the ui.R part of the app so you need to use renderUi/uiOutput to dynamically generate your selectInput.
In your ui.R
you could add:
uiOutput("secondSelection")
and in your server.R
:
output$secondSelection <- renderUI({
selectInput("User", "Date:", choices = as.character(dat5[dat5$email==input$Select,"date"]))
})
You can also do it whout changing ui.R
. At least that solution works in an App that I did. Ading this to server.R
should have the same effect.
observe({
updateSelectInput(session, "User", choices = as.character(dat5[dat5$email==input$Select, date]))
})
Though it is a useful and powerful too, I find it "cleaner" te get by without renderUI
. It keeps the UI in the UI and the server in the server. But that is just a matter of taste, I suppose.