title: Pass list of arguments to mutate_at
body: <p>I'm sure there's a way to do this but I can't figure it out. I'd like to be able to pass a list of arguments to <code>mutate_at()</code> within a function without having to specify each argument</p>
  
  <pre class="lang-r prettyprint-override"><code>library(tidyverse)
  
  fake_data &lt;-
    tibble(
      id = letters[1:6],
      ind_group_a = rep(0:1, times = 3),
      ind_group_b = rep(1:0, each = 3)
    )
  
  #  id    ind_group_a ind_group_b
  #   a              0           1
  #   b              1           1
  #   c              0           1
  #   d              1           0
  #   e              0           0
  #   f              1           0
  </code></pre>
  
  <p>This function will then converts all 1's to "yes" and 0's to "no"</p>
  
  <pre class="lang-r prettyprint-override"><code>recode_indicator &lt;- function(x, if_1 = "yes", if_0 = "no") {
    ifelse(x == 1, if_1, if_0)
  }
  </code></pre>
  
  <p>And I can use it fine like so:</p>
  
  <pre class="lang-r prettyprint-override"><code>fake_data %&gt;%
    mutate_at(
      vars(starts_with("ind_")),
      recode_indicator,
      if_1 = "Has",
      if_0 = "Missing"
    )
  
  # id    ind_group_a ind_group_b
  # chr&gt; &lt;chr&gt;       &lt;chr&gt;      
  #  a     Missing     Has        
  #  b     Has         Has        
  #  c     Missing     Has        
  #  d     Has         Missing    
  #  e     Missing     Missing    
  #  f     Has         Missing 
  </code></pre>
  
  <p>This is a simplified example but what I'd like to do is make it available in a function without having to write out all of the arguments. Ideally something short like <code>binary_values = list(...)</code>but I can't figure out how to pass these items as the additional arguments of <code>recode_indicator()</code></p>
  
  <pre class="lang-r prettyprint-override"><code>roll_up_indicators &lt;- function(x,
                                 #binary_values = list(if_1 = "yes", if_0 = "no"),
                                 ...) {
  
    ind_cols &lt;- grep("^ind_", names(x))
  
    df &lt;-
      x %&gt;%
      rename_at(ind_cols, str_remove, "^ind_") %&gt;% 
      mutate_at(
        ind_cols,
        recode_indicator # ,
        # binary_values # &lt;- here's the problem area
      ) %&gt;%
      group_by_at(ind_cols) %&gt;%
      count() %&gt;%
      ungroup()
  
    knitr::kable(df, ...)
  }
  
  
  fake_data %&gt;% roll_up_indicators()
  
  #  |group_a |group_b |  n|
  #  |:-------|:-------|--:|
  #  |No      |No      |  1|
  #  |No      |Yes     |  2|
  #  |Yes     |No      |  2|
  #  |Yes     |Yes     |  1|
  </code></pre>
  
  <p><strong>Update</strong></p>
  
  <p>In terms of not rewriting all of the arguments, the <code>formals()</code> function can be used:</p>
  
  <pre class="lang-r prettyprint-override"><code>roll_up_indicators &lt;- function(x,
                                 binary_values = formals(recode_indicator), # &lt;--- formals
                                 ...) {
  
    ind_cols &lt;- grep("^ind_", names(x))
  
    df &lt;-
      x %&gt;%
      rename_at(ind_cols, str_remove, "^ind_") %&gt;%
      mutate_at(
        ind_cols,
        partial(recode_indicator, !!!binary_values) # &lt;--- the winning answer
      ) %&gt;%
      group_by_at(ind_cols) %&gt;%
      count() %&gt;%
      ungroup()
  
    knitr::kable(df, ...)
  }
  </code></pre>