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", tabPanel("Summary", textOutput("summary"), value = "summary"), tabPanel("Trend", plotOutput("trend"), value = "trend"), tabPanel("Map", leafletOutput("map"), p("Map data is from the most recent year in the selected range"), value = "map"))
As you can see, the whole panel is given an ID (theTabs) and then each tabPanel is also given a name (summary, trend, map). 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 ...