title: Replacing group_by_at(NULL) using across
body: <p>Before, I used <code>group_by_at</code> to group by a vector of strings or by NULL:</p>
  
  <pre class="lang-r prettyprint-override"><code>library(tidyverse)
  
  grouping_1 &lt;- c("cyl", "vs")
  grouping_2 &lt;- NULL
  
  mtcars %&gt;% group_by_at(grouping_1) 
  mtcars %&gt;% group_by_at(grouping_2) 
  </code></pre>
  
  <p>The help of <code>group_by_at</code> indicates that the function is superseded and that <code>across</code> should be used instead. But, grouping by NULL gives an error</p>
  
  <pre class="lang-r prettyprint-override"><code>mtcars %&gt;% group_by(across(grouping_1)) # this works
  mtcars %&gt;% group_by(across(grouping_2)) # this gives an error
  </code></pre>
  
  <p>For me, <code>group_by_at</code> used in the way described has been useful because in my functions I can use the same code without checking every time whether the grouping argument is empty (NULL) or not.</p>