title: R tm package stemCompletion 'Out of Memory'
body: <p>I have been trying to work through the following tutorial: <a href="http://www.rdatamining.com/examples/text-mining" rel="nofollow">http://www.rdatamining.com/examples/text-mining</a> however, instead of using the twitter data I have been using .csv file (unfortunately the contents are sensitive and cannot be made public).</p>
  
  <p>The .csv file has two columns a user key in column A and a piece of narrative text (Response) in column B. The file has been opened with the following code,</p>
  
  <pre><code>Data &lt;- read.csv(file="PATH/FILE.csv", header=TRUE, sep=",", stringsAsFactors=FALSE)
  Data &lt;- Data[!(Data$Response==""), ]
  df&lt;- do.call("rbind", lapply(Data$Response, as.list))
  </code></pre>
  
  <p>df is a 'list of 91' with each item in the list being of type "character".</p>
  
  <p>The tutorial is followed from the line library(tm) with no differences except the addition of <code>NarrativeCorpus &lt;- tm_map(NarrativeCorpus, PlainTextDocument)</code> after <code>myCorpus &lt;- tm_map(myCorpus, removeWords, myStopwords)</code>, which I found was needed for stemming.</p>
  
  <p>The code fails at stem completion: <code>myCorpus &lt;- tm_map(myCorpus, stemCompletion, dictionary=dictCorpus)</code> with the error,</p>
  
  <blockquote>
    <p>Error in grep(sprintf("^%s", w), dictionary, value = TRUE) : 
       invalid regular expression, reason 'Out of memory'</p>
  </blockquote>
  
  <p>I have tried to look on-line and on stack overflow with little luck.</p>
  
  <p>I have tried converting the reference dictionary into a list of unique words then back into a corpus (to reduce its size) but to no avail.</p>
  
  <p>I am using R 64-bit 3.2.3 with RStudio Desktop 0.99.891 on a Windows 7 laptop with 4GB RAM. All packages are up to date (according to RStudio).</p>
  
  <p>This is my first SO post so I welcome advise on what I should have included and why, etc..</p>