title: In R, how does one coerce a Matrix to a Data Frame?
body: <p>I want to convert a simple Matrix to a Data Frame in R.</p>
  
  <pre><code>library(Matrix)
  
  m &lt;- Matrix(c(1:6), 2, 3)
  rownames(m) &lt;- c("row a", "row b")
  colnames(m) &lt;- c("col a", "col b", "col c")
  df &lt;- as.data.frame(m)
  </code></pre>
  
  <p>This results in an error:</p>
  
  <pre><code>Error in as.data.frame.default(m) : 
    cannot coerce class "structure("dgeMatrix", package = "Matrix")" to a data.frame
  </code></pre>