title: Take the positive part of values in a matrix in R
body: <p>I have 2 vectors <code>z</code>, <code>v</code>and I want to find the value of (z- v)_{+} which + means that if z bigger than v put it equal to z-v and else is zero.</p>
  
  <pre><code>      z = c(0.00000000, 0.00000000, 0.05626874, 0.17529181, 0.25865020, 0.27993760,
       0.52217908, 0.85310551, 1.13850492, 2.08570299)
       v= c( 0.00000000, 0.05626874, 0.07096722, 0.17529181, 0.17574861, 0.25865020,
       0.27993760, 0.28331125, 0.34191489, 0.52217908, 0.56703446, 0.67147343,
       0.85310551, 1.00063564, 1.13850492, 1.24488131, 1.36113151, 2.08570299,4.12977829)
  </code></pre>
  
  <p>I can create the matrix of mat1 , but I want to put (z_ij - v_ij) instead of true and else equal to zero. How can I do this in R?  </p>
  
  <pre><code>   mat1 = sapply(1:length(v), function(i) outer(z, v[i], "&gt;"))
  </code></pre>