Convert Matrix to table in R
<p>I have a network graph as a matrix, loaded through a csv in R, and it counts the number of SMS messages between people. e.g:</p>

<pre><code>NULL   john    mary    jim    bob    sue
john   0       5       2      0      1
mary   5       0       2      0      5
jim    2       2       0      8      10
bob    0       0       8      0      0
sue    1       5       10     0      0
</code></pre>

<p>I want to transpose this for gephi into a table that works like this:</p>

<pre><code>SOURCE    TARGET    WEIGHT
john      mary      5
john      jim       2
john      bob       0
john      sue       1
mary      jim       2
mary      bob       0
mary      sue       5
jim       bob       8
jim       sue       10
bob       sue       0
</code></pre>

<p>Then I can visualise and play with it as a network graph in gephi.</p>

<p>Is there a quick R operation to use on the matrix ('m') to make it into the table and export it as another csv file?</p>

<p>Thanks :)</p>