Using purrr::pmap within mutate to create list-column : <p>I understand how to use map to iterate over arguments in a df and create a new list column.</p>

<p>For example, </p>

<pre><code>params &lt;- expand.grid(param_a = c(2, 4, 6)
                  ,param_b = c(3, 6, 9)
                  ,param_c = c(50, 100)
                  ,param_d = c(1, 0)
                  )

df.preprocessed &lt;- dplyr::as.tbl(params) %&gt;%
  dplyr::mutate(test_var = purrr::map(param_a, function(x){
      rep(5, x)
      }
    ))
</code></pre>

<p>However, how do I use the analogous syntax with pmap in the event that I want to specify more than 2 parameters?</p>

<pre><code>df.preprocessed &lt;- dplyr::as.tbl(params) %&gt;%
  dplyr::mutate(test_var = purrr::pmap(list(x = param_a
                                     ,y = param_b
                                     ,z = param_c
                                     ,u = param_d), function(x, y){
                                        rep(5,x)*y
                                     }
  )
  )
</code></pre>

<p>Error output:</p>

<blockquote>
  <p>Error in mutate_impl(.data, dots) : 
    Evaluation error: unused arguments (z = .l[[c(3, i)]], u = .l[[c(4, i)]]).</p>
</blockquote>
