title: Sum of antidiagonal of a matrix
body: <p>I'm trying to sum the elements along the antidiagonal (secondary diagonal, minor diagonal) of a matrix.</p>
  
  <p>So, if I have a matrix m:</p>
  
  <pre><code>m &lt;- matrix(c(2, 3, 1, 4, 2, 5, 1, 3, 7), 3)
  m
  
       [,1] [,2] [,3]
  [1,]    2    4    1
  [2,]    3    2    3
  [3,]    1    5    7
  </code></pre>
  
  <p>I'm looking for the sum <code>m[3, 1] + m[2, 2] + m[1, 3]</code>, i.e. <code>1 + 2 + 1</code></p>
  
  <p>I can't figure out how to set up an iteration. As far as I know there is no function for this (like <code>diag()</code> for the other diagonal).</p>