title: Convert from n x m matrix to long matrix in R
body: <p>Note: This is not a graph question.</p>
  
  <p>I have an n x m matrix:</p>
  
  <pre><code>&gt; m = matrix(1:6,2,3)
  &gt; m
    a  b  c
  d 1  2  3
  e 4  5  6
  </code></pre>
  
  <p>I would like to convert this to a long matrix:</p>
  
  <pre><code>&gt; m.l
  a d 1
  a e 4
  b d 2
  b e 5
  c d 3
  c e 6
  </code></pre>
  
  <p>Obviously nested for loops would work but I know there are a lot of nice tools for reshaping matrixes in R. So far, I have only found literature on converting from long or wide matrixes to an n x m matrix and not the other way around. Am I missing something obvious? How can I do this conversion?</p>
  
  <p>Thank you!</p>