title: purrr pmap function arguments
body: <p>Functional programming with either <code>*apply</code> or <code>purrr</code> is my bread and butter yet I do not understand how <code>pmap</code> handles function arguments.</p>
  <ol>
  <li>I can use their corresponding <strong>variable names</strong> (given a data frame as input) and do not have to worry about the order.</li>
  <li>I can be more specific and use them as <strong>named arguments</strong></li>
  <li>I can use <strong>similar</strong> argument names</li>
  <li>Yet I <strong>cannot</strong> use completely different names.</li>
  </ol>
  <p>I've been looking through multiple similar questions yet fell short to find the appropriate answer to</p>
  <p>A) what is going on and</p>
  <p>B) how can I use arbitrary function argument names?</p>
  <pre><code># dummy data -----------------------------------------------------------------
  (iter_tibble &lt;- tibble::tibble(a = 1:2,
                                 b = 3:4,
                                 c = 7:6))
  #&gt; # A tibble: 2 x 3
  #&gt;       a     b     c
  #&gt;   &lt;int&gt; &lt;int&gt; &lt;int&gt;
  #&gt; 1     1     3     7
  #&gt; 2     2     4     6
  
  # pmap it --------------------------------------------------------------------
  # standard way
  purrr::pmap(iter_tibble, function(a, b, c) {
    paste(a, b, c)
  })
  #&gt; [[1]]
  #&gt; [1] &quot;1 3 7&quot;
  #&gt; 
  #&gt; [[2]]
  #&gt; [1] &quot;2 4 6&quot;
  
  # switch order
  # works and a maps to a, b to b etc
  purrr::pmap(iter_tibble, function(b, c, a) {
    paste(a, b, c)
  })
  #&gt; [[1]]
  #&gt; [1] &quot;1 3 7&quot;
  #&gt; 
  #&gt; [[2]]
  #&gt; [1] &quot;2 4 6&quot;
  
  # name arguments
  purrr::pmap(iter_tibble, function(a1 = a, b1 = b, c1 = c) {
    paste(a1, b1, c1)
  })
  #&gt; [[1]]
  #&gt; [1] &quot;1 3 7&quot;
  #&gt; 
  #&gt; [[2]]
  #&gt; [1] &quot;2 4 6&quot;
  
  # name arguments and switch order
  purrr::pmap(iter_tibble, function(b1 = b, c1 = c, asterix = a) {
    paste(b1, asterix, c1)
  })
  #&gt; [[1]]
  #&gt; [1] &quot;3 1 7&quot;
  #&gt; 
  #&gt; [[2]]
  #&gt; [1] &quot;4 2 6&quot;
  
  # but when using a different initial letter
  # ERROR
  purrr::pmap(iter_tibble, 
              purrr::safely(  
                function(b1 = b, c1 = c, obelix = a) {
                  paste(b1, obelix, c1)
                }
              ))[1]
  #&gt; [[1]]
  #&gt; [[1]]$result
  #&gt; NULL
  #&gt; 
  #&gt; [[1]]$error
  #&gt; &lt;simpleError in .f(...): unused argument (a = 1)&gt;
  </code></pre>
  <p>This behavior is rather different from how arguments can be called in regular R functions where abbreviations are possible (yet bad practice) but extensions are not possible.</p>
  <pre><code># regular function usage -----------------------------------------------------
  # abbrevate arguments - no problem
  sample(1:4, s = 5, repla = TRUE)
  #&gt; [1] 1 3 4 3 1
  
  # extend arguments? nope
  sample(1:4, size = 5, replaceeeee = TRUE)
  #&gt; Error in sample(1:4, size = 5, replaceeeee = TRUE): unused argument (replaceeeee = TRUE)
  </code></pre>
  <p>My guess Is that the answer is rather about the <code>pmap</code> call to C than what happens in R.</p>