Naming tabPanel elements
In order to allow testing for which tab is currently selected, we're going to have to first give the tabs of the tabbed output names. This is done as follows (with the new code in bold):
tabsetPanel(id = "theTabs", # give tabsetPanel a name tabPanel("Summary", textOutput("textDisplay"), value = "summary"), tabPanel("Trend", plotOutput("trend"), value = "trend"), tabPanel("Animated", plotOutput("animated"), value = "animated"), tabPanel("Map", plotOutput("ggplotMap"), value = "map"), tabPanel("Table", DT::dataTableOutput("countryTable"), value = "table")
As you can see, the whole panel is given an ID (theTabs
) and then each tabPanel
is also given a name (summary
, trend
, animated
, map
, and table
). They are referred to in the server.R
file very simply as input$theTabs
.
Finally, we can make our changes to ui.R
to remove parts of the UI based on tab selection:
conditionalPanel( condition = "input.theTabs == 'trend'", checkboxInput("smooth...