The task is to filter a dataframe reactively when the tabpanel changes. This is harder to figure out than one might think. 
In order to do that you have to define an id for the tabsetPanel, otherwise there will be nothing to "react" to. Since one normally does not need it, most examples don't have that id field, and thus it can be hard to stumble across. It is not documented in the help under ?tabsetPanel for example.
Here is a minimal example that does what you are looking for. 
- It creates a tabsetPanelwith twotabPanels
- the tabsetPanelhas anidcalledtabx.
- It defines a dataframe named basedfwith two kinds of rows, "A" and "B"
- A filter value is stored as an element in a reactiveValuesvariable.
- It sets that filter when the tab changes (the input$tabxstatement is necessary for that to happen, otherwise the built-in reactive caching will cause it to be triggered only once).
- There is a reactive output field that filters the basedfand prints out what remains.
The code:
library(shiny)
library(dplyr)
basedf <- data.frame(base=c("A","B","A","B","B","A"),val=1:6)
u <- shinyUI(fluidPage(
  titlePanel(h2("TabPanel Test")),
  sidebarLayout(        
    sidebarPanel(
      verbatimTextOutput("out1")
    ),        
    mainPanel(
      tabsetPanel(id="tabx",
        tabPanel("tab A", textOutput("outA")), 
        tabPanel("tab B", textOutput("outB"))
      )
    )
  )
))
s <- shinyServer(function(input,output){
  rv <- reactiveValues(curtab=NULL)
  output$outA <- renderText({
    input$tabx
    rv$curfilt <- "A"
    "this is tab A"
  })
  output$outB <- renderText({
    input$tabx
    rv$curfilt <- "B"
    "this is tab b"
  })
  output$out1 <- renderPrint({
    print(sprintf("curtab:%s",input$tabx))
    print(sprintf("curfilt:%s",rv$curfilt))
    ndf <- filter(basedf,base==rv$curfilt)
    print(ndf)
  })
})
shinyApp(u,s)
And here is what the output looks like:
