title: Convert Document Term Matrix (DTM) to Data Frame (R Programming)
body: <p>I am a beginner at R programming language and currently try to work on a project. 
  There's a huge Document Term Matrix (DTM) and I would like to convert it into a Data Frame. 
  However due to the restrictions of the functions, I am not able to do so. </p>
  
  <p>The method that I have been using is to first convert it into a matrix, and then convert it to data frame. </p>
  
  <pre><code>DF &lt;- data.frame(as.matrix(DTM), stringsAsFactors=FALSE)
  </code></pre>
  
  <p>It was working perfectly with smaller size DTM. However when the DTM is too large, I am not able to convert it to a matrix, yielding the error as shown below:</p>
  
  <blockquote>
    <p><strong>Error</strong>: cannot allocate vector of size 2409.3 Gb</p>
  </blockquote>
  
  <p>Tried looking online for a few days however I am not able to find a solution. 
  Would be really thankful if anyone is able to suggest what is the best way to convert a DTM into a DF (especially when dealing with large size DTM). </p>