title: Melt a dummy matrix to a column
body: <p>If I have a factor variable, say <code>x = factor(c(1, 2, 3))</code>, then I can use <code>model.matrix</code> function to generate a dummy matrix:</p>
  
  <pre><code>model.matrix(~x + 0)
  </code></pre>
  
  <p>and I will get a matrix like: </p>
  
  <pre><code>  x1 x2 x3
  1  1  0  0
  2  0  1  0
  3  0  0  1
  </code></pre>
  
  <p>My question is that, if I already have a large dummy matrix, how could I melt it back to a (factor) column?</p>
  
  <p>In another world, is there an inverse function of <code>model.matrix</code>?</p>