title: RShiny: how can I summarise/subset/filter data using checkboxGroupInput?
body: <p>I'm trying to use checkbox input to subset, filter, and summarise data. I've mocked up the problem with iris data.  </p>
  
  <p>I'm trying to allow the user to summarise iris data by sepal width/length, petal width/length, or both.  Individually, each checkbox works, but using multiple input options is NOT working.  Selecting both "Sepal" and "Petal" returns only Sepal data.</p>
  
  <p>UI:</p>
  
  <pre><code>ui &lt;- fluidPage(
      fluidRow(
          box(
              title = "Choose data", width = 3, solidHeader = TRUE,
              status = "primary", collapsible = TRUE,
              checkboxGroupInput("iris_select", "Select measurements:",
                          choices = list("Sepal", "Petal"),
                          selected = c("Sepal")),
              verbatimTextOutput("whatdidiselect")),
  
          box(
              title = "See your data output", width = 9, solidHeader = TRUE,
              status = "success", collapsible = TRUE,
              DT::dataTableOutput("iris_output")
          )))
  </code></pre>
  
  <p>And server:</p>
  
  <pre><code>server &lt;- function(input, output) {
  
       output$whatdidiselect &lt;- renderText(input$iris_select)
  
       iris_summary &lt;- reactive({
          if(all(c("Sepal") %in% input$iris_select)){
              iris %&gt;% 
                  group_by(., Species) %&gt;%
                  summarise(Mean_Sepal_Length = mean(Sepal.Length),
                            Mean_Sepal_Width = mean(Sepal.Width))}
  
              if(all(c("Petal") %in% input$iris_select)){
                  iris %&gt;% 
                      group_by(., Species) %&gt;%
                      summarise(Mean_Petal_Length = mean(Petal.Length),
                                Mean_Petal_Width = mean(Petal.Width))}
  
                  if(all(c("Sepal", "Petal") %in% input$iris_select)){
                      iris %&gt;% 
                          group_by(., Species) %&gt;%
                          summarise(Mean_Sepal_Length = mean(Sepal.Length),
                                    Mean_Sepal_Width = mean(Sepal.Width),
                                    Mean_Petal_Length = mean(Petal.Length),
                                    Mean_Petal_Width = mean(Petal.Width))} 
      })
  
      output$iris_output &lt;- DT::renderDataTable({
          iris_summary()})
  }
  </code></pre>
  
  <p>This seems like it should be simple.  Can someone point out where I'm going wrong?</p>