title: termdocumentmatrix raises error in R
body: <p>I have the following code:</p>
  
  <pre><code>library(tm)
  text&lt;-readLines("anyText.txt")
  corpus&lt;-Corpus(VectorSource(text))
  corpus&lt;-tm_map(corpus,content_transformer(tolower))
  inspect(corpus)
  corpus&lt;-tm_map(corpus,removePunctuation)
  stopwords&lt;-c(stopwords('english'),"available","via")
  corpus&lt;-tm_map(corpus,removeWords,stopwords)
  tempCorpus&lt;-corpus
  inspect(tempCorpus)
  library(ctv)
  library(SnowballC)
  corpus&lt;-tm_map(corpus,stemDocument)
  inspect(corpus)
  corpusT&lt;- tm_map(corpus, PlainTextDocument)
  corpusT&lt;-tm_map(corpusT,stemCompletion,dictionary=tempCorpus)
  dtm&lt;-TermDocumentMatrix(corpusT,control=list(minWordLength=1))
  </code></pre>
  
  <p>but I got the error:</p>
  
  <pre><code>   Error: inherits(doc, "TextDocument") is not TRUE
  </code></pre>
  
  <p>I found that when I comment the line:</p>
  
  <pre><code>corpusT&lt;-tm_map(corpusT,stemCompletion,dictionary=tempCorpus)
  </code></pre>
  
  <p>the program works fine, but for what I know that last line is for updating the list of steem words with the ones I got in tempCorpus so I need it.</p>
  
  <p>How can I correct that error?</p>