the below works
library(shiny)
ui <- (basicPage(
tabsetPanel(id = "tabs",
tabPanel("Tab A", value = "A",
"This is Tab A content",
textOutput("tabA")),
tabPanel("Tab B", value = "B",
"Here's some content for tab B.",
textOutput("tabB")))
))
server <- function(input, output, session) {
output$tabA <- renderText({paste0("You are viewing tab ", input$tabs)})
output$tabB <- renderText({paste0("You are viewing tab ", input$tabs)})
}
shinyApp(ui = ui, server = server)
I would like to select the name of the output depending on which tab is selected.
output[["tabA"]] <- renderText({paste0("You are viewing tab ", input$tabs)})
the above is fine but the below does't work since it wants a reactive context.
output[[paste0("tab", input$tabs)]] <- renderText({paste0("You are viewing tab ", input$tabs)})
Is there a way to do this?