title: dplyr using complete() in loop to retain factors levels
body: <p>I am trying to retain factor levels after using summarise in a loop. 
  I replicate my problem using a mock dataset. </p>
  
  <pre><code>df = data.frame(a=rep(1:3,4), b=rep(1:2,6),c=rep(1:2,6),d=rep(1:2,6))
  df$b = factor(df$b, levels=1:3)
  #the group are for the loop. Since it's just an example have only 1 value
  outer_group &lt;- c("a") 
  inner_group &lt;- c("b")
  </code></pre>
  
  <p>My desired output is achieved using this code hereunder. However, using this approach i need to manually change the column of <code>complete()</code> in case I have multiple values in the loop </p>
  
  <pre><code>for (o in outer_group){
      for(i in inner_group){
          df %&gt;%
              group_by_at(i) %&gt;%
              summarise(count_a=length(!!o)) %&gt;%
              complete(b) -&gt; a
      }
  
  }
  </code></pre>
  
  <p>For such reason, I tried to change it to <code>complete(!!i)</code> such as </p>
  
  <pre><code>for (o in outer_group){
      for(i in inner_group){
          df %&gt;%
              group_by_at(i) %&gt;%
              summarise(count_a=length(!!o)) %&gt;%
              complete(!!i) -&gt; a
      }
  
  }
  </code></pre>
  
  <p>Unfortunately, this does not work                                      </p>
  
  <pre><code>Error: `by` can't contain join column `"b"` which is missing from RHS
  </code></pre>
  
  <p>Any help is appreciated</p>
  
  <p>Desired output: </p>
  
  <pre><code># A tibble: 3 x 2                                  
    b     count_a
    &lt;fct&gt;   &lt;int&gt;
  1 1           1
  2 2           1
  3 3          NA
  </code></pre>