title: How to do this matrix"operation" in R?
body: <p>So I have this diagonal matrix</p>
  <pre><code>&gt; M
     a  b  c  d
   a 2  3  5  4
   b .  3  6  4
   c .  .  4  6
   d .  .  .  3
   &gt; 
  </code></pre>
  <p>and what I want to do is the following, I want to access the the following elements:
  <strong>(a,a), (a,b), (a,c), (a,d)</strong>. That would be easy, it would be just the first row.</p>
  <p>But I would also be needing</p>
  <p><strong>(b,a), (b,b), (b,c), (b,d)</strong>. would be <strong>(3,3,6,4)</strong></p>
  <p><strong>(c,a), (c,b), (c,c), (c,d)</strong>.  would be <strong>(5,6,4,6)</strong></p>
  <p><strong>(d,a), (d,b), (d,c), (d,d)</strong>.  would be <strong>(4,4,6,3)</strong></p>
  <p>How could I access those? I would like to return a row or column vector in each case with these elements.
  What I tried here was to copy those elements manually, but I really would like to how to do it in case of a larger matrix?</p>