title: How to Output a List of Summaries From Different Grouping Variables When Using Dplyr::Group_by and Dplyr::Summarise
body: <pre><code>library(tidyverse)
  </code></pre>
  
  <p>Using a simple example from the mtcars dataset, I can group by cyl and get basic counts with this...</p>
  
  <pre><code>mtcars%&gt;%group_by(cyl)%&gt;%summarise(Count=n())
  </code></pre>
  
  <p>And I can group by both cyl and am...</p>
  
  <pre><code>mtcars%&gt;%group_by(cyl,am)%&gt;%summarise(Count=n())
  </code></pre>
  
  <p>I can then create a function that will allow me to input multiple grouping variables. </p>
  
  <pre><code>Fun&lt;-function(dat,...){
  dat%&gt;%
  group_by_at(vars(...))%&gt;%
  summarise(Count=n())
  }
  </code></pre>
  
  <p>However, rather than entering multiple grouping variables, I would like to output a list of two summaries, one for counts with cyl as the grouping variable, and one for cyl and am as the grouping variables. </p>
  
  <p>I feel like something similar to the following should work, but I can't seem to figure it out. I'm hoping for an rlang or purrr solution. Help would be appreciated. </p>
  
  <pre><code>Groups&lt;-list("cyl",c("cyl","am"))
  
  mtcars%&gt;%group_by(!!Groups)%&gt;%summarise(Count=n())
  </code></pre>