My brand new Shiny App has one sidePanel with two dynamic SelectInput() functions. Depending on which Panel is active, the respective uiOutput("select") dynamic SelectInput should be use. I read this could be done with conditionalPanel() - but I cannot figure out how ... non of the examples I found combine uiOutput("select")/SelectInput(), all use SelectInput directly in the Pane...
Please, can anyone help me, how I have to change the code to include conditionalPanel()- if this is what's necessary. Thank a lot for any advice and help!!!!
ui.R
shinyUI(fluidPage(
titlePanel('Table Overviews'),
sidebarPanel(
uiOutput("select1"),
br(),
uiOutput("select2")
),
mainPanel(
tabsetPanel(
tabPanel("Panel 1",
fluidRow(
column(6, h4("Tablel"), tableOutput("Table1")),
column(6, div(style = "height:300px")),
fluidRow(
column(6,h4("Table2"), tableOutput("Table2")),
column(6,h4("Table3"), tableOutput("Table3")))
)),
tabPanel("Panel 2",
fluidRow(
column(6, h4("Table4"), tableOutput("Table4")),
column(6, div(style = "height:300px")),
fluidRow(
column(6,h4("Table5"), tableOutput("Table5")),
column(6,h4("Table6"), tableOutput("Table6")))
))
)
server.R
shinyServer(function(input,output){
## two different SelectInputs to select from two different lists
output$select1 <- renderUI({
selectInput("dataset1", "Overview1", as.list(files1))
})
output$select2 <- renderUI({
selectInput("dataset2", "Overview2", as.list(files2))
})
## Output of the first SelectInput
output$Table1 <- renderTable({
f1 <- function1(input$dataset1)
f1[[1]]
})
output$Table2 <- renderTable({
f1 <- function1(input$dataset1)
f1[[2]]
})
output$Table3 <- renderTable({
f1 <- function1(input$dataset1)
f1[[3]]
})
# Output of the second SelectInput
output$Table4<- renderTable({
f2 <- function2(input$dataset2)
f2[[3]]
})
output$Table5 <- renderTable({
f2 <- function2(input$dataset2)
f2[[2]]
})
output$Table6 <- renderTable({
f2 <- function2(input$dataset2)
f2[[1]]
})
})