title: Not able to see the choices of selectInput and get its count in shinyApp
body: <p>I'm building a shinyApp on mtcars data. I'm facing a problem in counting values and displaying choices  of <strong>cyl button</strong>. 
  When <strong>all</strong> is selected in <strong>disp button</strong>, then <em>cyl filter</em> shows accurate count and it displays the choices as well. If values other than <em>all</em> are selected in <em>disp</em> then <strong>cyl will give 0 count and won't show any choices</strong>.
  Can somebody please have a look at my codes. I shall be extremely grateful.</p>
  
  <p>library(shiny)<br>
      library(DT)<br>
      library(dplyr) 
      library(shinythemes) 
      library(htmlwidgets) 
      library(shinyWidgets) 
      library(shinydashboard)</p>
  
  <pre><code>data_table&lt;-mtcars    
  data_table$hp&lt;-NULL
  data_table$qsec&lt;-NULL
  data_table$drat&lt;-NULL
  
  #ui
  ui = fluidPage( 
    sidebarLayout(
      sidebarPanel (
  
        uiOutput("vs_selector"),
        uiOutput("carb_selector"),
        uiOutput("gear_selector"),
        uiOutput("cyl_selector"),
        valueBoxOutput("count_gear"),
        valueBoxOutput("count_cyl")),
  
  
      mainPanel(
  
        DT::dataTableOutput('mytable') 
  
      )
  
    ))
  
  
  
  
  #server
  server = function(input, output, session) {
  
    output$vs_selector &lt;- renderUI({
  
      selectInput(inputId = "vs",
                  label = "vs:", multiple = TRUE,
                  choices = c( unique(data_table$vs)),
                  selected = c(0))
  
    })
  
    output$carb_selector &lt;- renderUI({
  
      req(input$vs)
  
      available0 &lt;- data_table[c(data_table$vs %in% input$vs ), "carb"]  
  
      selectInput(
        inputId = "carb", 
        label = "carb:",
        multiple = TRUE,
        choices = c('All',as.character(unique(available0))),
        selected = c('4'))
  
    })
  
  
    output$gear_selector &lt;- renderUI({
  
      req(input$vs, input$carb)
  
      available &lt;- data_table[["gear"]][data_table$vs %in% input$vs]
      if(! "All" %in% input$carb){
        available &lt;- available[data_table$carb %in% input$carb]
      }
  
      selectInput(
        inputId = "gear", 
        label = "gear:",
        multiple = TRUE,
        choices = c('All',as.character(unique(available))),
        selected = c('4'))
  
    })
  
  
  
    output$cyl_selector &lt;- renderUI({
  
      req(input$vs, input$carb, input$gear)
  
      available &lt;- data_table[["cyl"]][data_table$vs %in% input$vs]
  
  
  
  
      selectInput(
        inputId = "cyl", 
        label = "cyl:",
        multiple = TRUE,
        choices = c('All',as.character(unique(available))),
        selected = c('6', '8', '4'))
  
    })
  
  
  
  
  
    output$count_gear &lt;- renderValueBox({
  
  
      valueBox(
        value = length(unique(thedata()[["gear"]])), 
  
  
        subtitle = sprintf("Number of gear values" ))   
  
    })
  
  
  
  
    output$count_cyl &lt;- renderValueBox({
  
      #req(input$vs, input$carb, input$gear)
  
      #available &lt;- data_table[["cyl"]][data_table$vs %in% input$vs]
  
  
  
  
  
      valueBox(
  
  
        # if("All" %in% input$cyl) {
        #    value = "All"
        #  } else(value = length(unique(input$cyl))),
  
        value = length(unique(thedata()[["cyl"]])),
  
        subtitle = sprintf("Number of cyl values" ))   
  
    })
  
  
  
  
  
  
  
    thedata &lt;- reactive({
  
      req(input$gear, input$vs, input$carb, input$cyl)
  
      data_table&lt;-data_table[data_table$vs %in% input$vs,]
  
      if(! "All" %in% input$carb){
        data_table&lt;-data_table[data_table$carb %in% input$carb,]
      }
  
      if(! "All" %in% input$gear){
        data_table&lt;-data_table[data_table$gear %in% input$gear,]
      }
  
  
      if(! "All" %in% input$cyl){
        data_table&lt;-data_table[data_table$cyl %in% input$cyl,]
      }
  
  
      data_table
  
    })
  
  
    output$mytable = DT::renderDataTable({
  
      DT::datatable( {     
  
        thedata()   # Call reactive thedata()
  
      })
  
    })
  
  }  
  
  shinyApp(ui = ui, server = server)
  </code></pre>