title: Comparing two matrix (A & B) and output a new matrix C with cij = min(aij, bij)
body: <p>The title is fairly clear, but I'm trying to take two matrices, A and B, and output a matrix C that has the minimum elements from the two matrices. </p>
  
  <p>cij = min(aij, bij)</p>
  
  <p>This is how I'm considering doing it this way:</p>
  
  <pre><code>C &lt;- matrix(ncol = ncol(A), nrow = nrow(A), 0)
  for (i in 1:ncol(C)) {
      Y &lt;- rbind(A[i,], B[i,])
      C[i,] &lt;- apply(Y, 2, min)
  }
  </code></pre>
  
  <p>However, I was hoping this could be vectorized but I can't think how to do it. I haven't found anything so if anyone has any ideas, I'd greatly appreciate it.</p>
  
  <p>Thanks!</p>