title: Removing overly common words (occur in more than 80% of the documents) in R
body: <p>I am working with the 'tm' package in to create a corpus. I have done most of the preprocessing steps.
  The remaining thing is to remove overly common words (terms that occur in more than 80% of the documents). Can anybody help me with this?</p>
  
  <pre><code>dsc &lt;- Corpus(dd)
  dsc &lt;- tm_map(dsc, stripWhitespace)
  dsc &lt;- tm_map(dsc, removePunctuation)
  dsc &lt;- tm_map(dsc, removeNumbers)
  dsc &lt;- tm_map(dsc, removeWords, otherWords1)
  dsc &lt;- tm_map(dsc, removeWords, otherWords2)
  dsc &lt;- tm_map(dsc, removeWords, otherWords3)
  dsc &lt;- tm_map(dsc, removeWords, javaKeywords)
  dsc &lt;- tm_map(dsc, removeWords, stopwords("english"))
  dsc = tm_map(dsc, stemDocument)
  dtm&lt;- DocumentTermMatrix(dsc, control = list(weighting = weightTf, 
                           stopwords = FALSE))
  
  dtm = removeSparseTerms(dtm, 0.99) 
  # ^-  Removes overly rare words (occur in less than 2% of the documents)
  </code></pre>