title: Pass arbitrary number of variables into facet_grid()
body: <p>I'm trying to develop a function that will create a plot from just a few arguments. I need it to be flexible, so that I can input an unknown number of variables to facet the graph by. I've used all the quoting/unquoting methods I can find: <code>{{ }}</code>, <code>.data[]</code>, <code>!!!</code>, <code>inject</code>, and more. I think part of the problem is that <code>facet_grid</code> calls it's variables within <code>vars()</code>, which is not cooperating with these operators. I have also tried passing the variables that I want to facet by into the function using dots, and by a named argument that takes a vector.</p>
  <p>It seems to me that the best option here, based on this article (<a href="https://adv-r.hadley.nz/quasiquotation.html" rel="nofollow noreferrer">https://adv-r.hadley.nz/quasiquotation.html</a>) is the unquote-splice operator. It seems to me like one of these should work, but neither does:</p>
  <pre><code>make_graph &lt;- function (factor.by){
    ggplot(mpg, aes(cyl, cty)) + 
      geom_col() + 
      facet_grid(cols = vars(!!!factor.by))
  }
  
  
  make_graph(factor.by = c(&quot;manufacturer&quot;, &quot;model&quot;))
  
  
  make_graph_2 &lt;- function (...){
    ggplot(mpg, aes(cyl, cty)) + 
      geom_col() + 
      facet_grid(cols = vars(...))
  }
  
  make_graph_2(&quot;manufactuer&quot;, &quot;model&quot;)
  </code></pre>
  <p>I would really appreciate any help figuring out how to make this work! I'm pretty new to programming with R, and I've been stuck on this issue for a long time. Thank you so much!</p>