title: Shiny App: How to select only one category of variable and not filter for the others in the sliders
body: <p>I have created this SHINY APP with sliders to first select a variable of interest and then, depending on the variable selected, choose the category of the variable of interest. I would like to generate a &quot;head&quot; of the dataset that emerges from the choices, so that it changes following the selection of the variable and then the chosen category.
  The problem is that with this code the dataset head filters for the category of the selected variable and then considers the first category for the other two variables. E.g.: if I select Treatment=Medicine, it considers Region=America and Previous=0. Instead I would like it to consider all the categories of Region and Previous and select only Treatment=Medicine.</p>
  <p>Below is the code for my UI:</p>
  <pre><code>ui &lt;- fluidPage( titlePanel(&quot;My Shiny App.&quot;),
  selectInput(&quot;selection&quot;, &quot;Choose a Variable&quot;, choices = c(&quot;TREAT&quot;, &quot;REGION&quot;, &quot;PREVIOUS&quot;) ),
  
  #Only show this panel if the var is a TRT
  conditionalPanel( &quot;input.selection == 'TREAT'&quot;, selectInput(&quot;trt&quot;, 
  &quot;Choose a Treatment&quot;, choices = c(&quot;Medicine&quot;, &quot;Placebo&quot;)) ),
  
  #Only show this panel if the var is REGION
  conditionalPanel( &quot;input.selection == 'REGION'&quot;, selectInput(&quot;reg&quot;, 
  &quot;Choose a Region&quot;, choices = c(&quot;America&quot;, &quot;Europe&quot;, &quot;Asia&quot;, &quot;Latin America&quot;) ) ),
  
  #Only show this panel if the var is PREVIOUS
  conditionalPanel( &quot;input.selection == 'PREVIOUS'&quot;, selectInput(&quot;pre&quot;, 
  &quot;Yes or No?&quot;, choices = c(0,1)) ), mainPanel( textOutput(&quot;head&quot;) ) )
  </code></pre>
  <p>My code for SERVER:</p>
  <pre><code>server &lt;- function(input, output){
  
  output$selection&lt;- reactive({
  vars &lt;- switch(input$selection, 
                 &quot;TREAT&quot; = EBDB$TREAT,
                 &quot;REGION&quot; = EBDB$REGION,
                 &quot;PREVIOUS&quot; = EBDB$PREVIOUS)
                            })
  
  output$cat &lt;- reactive({
  
  if(input$selection ==&quot;TREAT&quot;){
        treat &lt;- switch(input$trt, 
                    &quot;Medicine&quot; = EBDB$TREAT==&quot;Medicine&quot;,
                    &quot;Placebo&quot; = EBDB$TREAT==&quot;Placebo&quot;) 
  }else if(input$selection ==&quot;REGION&quot;){
    
        regio &lt;- switch(input$reg, 
                    &quot;America&quot; = EBDB$REGION==&quot;America&quot;,
                    &quot;Europe&quot; = EBDB$REGION==&quot;Europe&quot;,
                    &quot;Asia&quot; = EBDB$REGION==&quot;Asia&quot;,
                    &quot;Latin America&quot; = EBDB$REGION==&quot;Latin America&quot;)
                                       }
  
  else if(input$selection == &quot;PREVIOUS&quot;){
    
        ph&lt;- switch(input$pre,
                    &quot;0&quot; = EBDB$PREVIOUS==0,
                    &quot;1&quot; = EBDB$PREVIOUS==1)
                                         }
                            })
  
  output$su &lt;- renderTable({
  
  if(input$selection ==&quot;TREAT&quot; &amp;&amp; (input$trt == &quot;Medicine&quot; || input$trt ==&quot;Placebo&quot;){
    
      subset.df &lt;- subset(EBDB, TREAT == input$trt &amp; REGION==EBDB$REGION &amp; PREVIOUS==EBDB$PREVIOUS)
                                                                                    } 
  else if (input$selection ==&quot;REGION&quot; &amp;&amp; (input$reg == &quot;America&quot; || input$reg ==&quot;Europe&quot;||input$reg == &quot;Asia&quot;|| input$reg == &quot;Latin America&quot;))){
    
      subset.df&lt;-subset(EBDB, REGION== input$reg &amp; TREAT == EBDB$TREAT &amp; PREVIOUS== EBDB$PREVIOUS)
  
  } else if(input$selection== &quot;PREVIOUS&quot; &amp;&amp; (input$pre==0 ||input$pre==1){
    
    subset.df &lt;- subset(EBDB, PREVIOUS == input$pah &amp; TREAT == EBDB$TREAT &amp; 
                        REGION==EBDB$REGION)
                                                                         }
  head(subset.df)
                        })
  }
  </code></pre>