title: Tidyeval with list of column names in a function
body: <p>I am trying to create a function that passes a list of column names to a <code>dplyr</code> function. I know how to do this if the list of columns names is given in the <code>...</code> form, as explained in the <code>tidyeval</code> documentation:</p>
  
  <pre><code>df &lt;- tibble(
    g1 = c(1, 1, 2, 2, 2),
    g2 = c(1, 2, 1, 2, 1),
    a = sample(5), 
    b = sample(5)
  )
  
  my_summarise &lt;- function(df, ...) {
    group_var &lt;- quos(...)
  
    df %&gt;%
      group_by(!!!group_var) %&gt;%
      summarise(a = mean(a))
  }
  
  my_summarise(df, g1, g2)
  </code></pre>
  
  <p>But if I want to list the column names as an argument of the function, the above solution will not work (of course):</p>
  
  <pre><code>my_summarise &lt;- function(df, group_var, sum_var) {
    group_var &lt;- quos(group_var) # nor enquo(group_var)
    sum_var &lt;- enquo(sum_var)
  
    df %&gt;%
      group_by(!!!group_var) %&gt;%
      summarise(a = mean(a))
  }
  
  my_summarise(df, list(g1, g2), a)
  my_summarise(df, list(g1, g2), b)
  </code></pre>
  
  <p>How can I get the items inside the list to be quoted individually?</p>
  
  <p>This question is similar to <a href="https://stackoverflow.com/q/43159428/2804314">Passing dataframe column names in a function inside another function</a> but in the comments it was suggested to use strings, while here I would like to use bare column names.</p>