title: understanding the output of a function
body: <p>Trying to understand how the value of &quot;traded&quot; is 34</p>
  <pre><code>available &lt;- c(10,4,7,10,12)
  desired &lt;- c(12,5,2,6,14)
  traded &lt;- sum(mapply(function(x,y) min(x,y), available, desired))
  </code></pre>
  <p>Correct value for traded is 34. Just not sure why this is the case. I thought the value would be 6 as the minimum values from each vector (4 and 2) summed together =6</p>