title: using `rlang` quasiquotation with `dplyr::_join` functions
body: <p>I am trying to write a custom function where I use <code>rlang</code>'s quasiquotation. This function also internally uses <code>dplyr</code>'s <code>join</code> functions. I have provided below a minimal working example that illustrated my problem. </p>
  
  
  
  <pre class="lang-r prettyprint-override"><code># needed libraries 
  library(tidyverse)
  
  # function definition
  df_combiner &lt;- function(data, x, group.by) {
    # check how many variables were entered for this grouping variable
    group.by &lt;- as.list(rlang::quo_squash(rlang::enquo(group.by)))
  
    # based on number of arguments, select `group.by` in cases like `c(cyl)`,
    # the first list element after `quo_squash` will be `c` which we don't need,
    # but if we pass just `cyl`, there is no `c`, this will take care of that
    # issue
    group.by &lt;-
      if (length(group.by) == 1) {
        group.by
      } else {
        group.by[-1]
      }
  
    # creating internal dataframe
    df &lt;- dplyr::group_by(.data = data, !!!group.by, .drop = TRUE)
  
    # creating dataframes to be joined: one with tally, one with summary
    df_tally &lt;- dplyr::tally(df)
    df_mean &lt;- dplyr::summarise(df, mean = mean({{ x }}, na.rm = TRUE))
  
    # without specifying `by` argument, this works but prints a message I want to avoid
    print(dplyr::left_join(x = df_tally, y = df_mean))
  
    # joining by specifying `by` argument (my failed attempt)
    dplyr::left_join(x = df_tally, y = df_mean, by = !!!group.by)
  }
  
  # using the function
  df_combiner(diamonds, carat, c(cut, clarity))
  
  #&gt; Joining, by = c("cut", "clarity")
  
  #&gt; # A tibble: 40 x 4
  #&gt; # Groups:   cut [5]
  #&gt;    cut   clarity     n  mean
  #&gt;    &lt;ord&gt; &lt;ord&gt;   &lt;int&gt; &lt;dbl&gt;
  #&gt;  1 Fair  I1        210 1.36 
  #&gt;  2 Fair  SI2       466 1.20 
  #&gt;  3 Fair  SI1       408 0.965
  #&gt;  4 Fair  VS2       261 0.885
  #&gt;  5 Fair  VS1       170 0.880
  #&gt;  6 Fair  VVS2       69 0.692
  #&gt;  7 Fair  VVS1       17 0.665
  #&gt;  8 Fair  IF          9 0.474
  #&gt;  9 Good  I1         96 1.20 
  #&gt; 10 Good  SI2      1081 1.04 
  #&gt; # ... with 30 more rows
  
  #&gt; Error in !group.by: invalid argument type
  </code></pre>
  
  <p>As can be seen here, I want to avoid the message <code>#&gt; Joining, by = c("cut", "clarity")</code> and so explicitly want to input the <code>by</code> argument for the <code>_join</code> function but I am not sure how to do this.
  (I've tried <code>rlang::as_string</code>, <code>rlang::quo_name</code>, etc.).</p>