title: melt the lower half matrix in R
body: <p>How can I melt a lower half triangle plus diagonal matrix ?</p>
  
  <pre><code>11 NA NA  NA  NA
  12 22 NA  NA  NA
  13 23 33  NA  NA
  14 24 34  44  NA
  15 25 35  45  55
      A &lt;- t(matrix (c(11,  NA, NA,  NA,  NA, 12, 22, NA,  NA,  NA,
     13, 23, 33,  NA,  NA, 14, 24, 34,  44,  NA,15, 25, 
     35,  45,  55), ncol = 5)) 
  
   &gt; A
       [,1] [,2] [,3] [,4] [,5]
  [1,]   11   NA   NA   NA   NA
  [2,]   12   22   NA   NA   NA
  [3,]   13   23   33   NA   NA
  [4,]   14   24   34   44   NA
  [5,]   15   25   35   45   55 
  </code></pre>
  
  <p>To data.frame in row and col (preserving the following order) </p>
  
  <pre><code>col  row   value 
  1     1      11
  1     2      12
  1     3      13
  1     4      14
  1     5      15
  2     2      22
  2     3      23
  2     4      24
  2     5      25
  3     3      33
  3     4      34
  3     5      35
  4     4      44
  4     5      45
  5     5      55
  </code></pre>