ui <- fluidPage(
titlePanel("Select the location and date of the observatory"),
sidebarPanel(
selectInput("loc", "Select the location",
c("chc" = "101", "sdg" = "108")
),
conditionalPanel(
condition = "input.loc == '101'",
selectInput(
"branch1","select branch:",
c("aa","bb","cc")
)),
conditionalPanel(condition = "input.loc == '108'",
selectInput("branch2","select branch:",
c("dd","ee","ff"))
),
dateRangeInput("date","select date:", start = "2020-01-01",end = "2021-05-29")
),
mainPanel(
dataTableOutput('table')
)
)
server <- function(input, output) {
output$table <- renderDataTable(
if(input$branch1 == "aa"){
subset(temp,stnld == "93")[,c(2,3,4,5)]}
else if(input$branch1 == "bb"){
subset(temp,stnld == "101")[,c(2,3,4,5)]}
else if(input$branch1 == "cc"){
subset(temp,stnld == "212")[,c(2,3,4,5)]}
else if(input$branch2 == "dd"){
subset(temp,stnld == "98")[,c(2,3,4,5)]}
else if(input$branch2 == "ee"){
subset(temp,stnld == "99")[,c(2,3,4,5)]}
else if(input$branch2 == "ff"){
subset(temp,stnld == "108")[,c(2,3,4,5)]}
,options = list(pageLength = 5))
}
shinyApp(ui, server)
Tables in aa,bb,cc in branch1 work, so why don't the tables in dd,ee,ff in branch2 change?
Thanks for your help