I'm trying to display a table in the mainpanel based on selection by the user from drop down.
Ex. The "selectInput" dropdown will have the values from table789 (options are 123, xyz, ...) If user selects 123 then "table123" has to be displayed else "table456" to be displayed.
I'm very new to shiny, tried the below and got "attempt to replicate an object of type 'closure'" error. I'm not sure what I'm missing. Can anyone help?
Server:
server = function(input, output, session) {
output$outputtable = reactive({ifelse(input$selction == '123', DT::renderDataTable(table123), DT::renderDataTable(table456)) })
}
UI:
ui <- fluidPage(
sidebarPanel(selectInput("selction", "Select", choices = table789$column1, selected = "xyz")),
mainPanel(
tabsetPanel(
tabPanel("select", DT::dataTableOutput("outputtable")),
)
)
)