title: Applying outer to columns within a matrix
body: <p>I have two matrices:
  x </p>
  
  <pre><code>A B C
  2 3 4
  3 4 5
  </code></pre>
  
  <p>and y</p>
  
  <pre><code>D E
  1 2
  3 2
  </code></pre>
  
  <p>How can I subtract the combination of elements within columns? Giving me the following result:</p>
  
  <pre><code>AD AE BD BE CD CE
  1  0  2  1  3  2
  0  1  1  2  2  3
  </code></pre>
  
  <p>I have tried applying outer, but can't make it work with matrices. Would vectorizing a function be a solution? I have tried the code below, but it doesn't seem to work. </p>
  
  <pre><code>vecfun= Vectorize(fun)
  fun=function(a,b)(a-b)
  outer(x,y, vecfun)
  </code></pre>
  
  <p>Thanks in advance for any advice.</p>