title: Remove words from a dtm
body: <p>I have created a dtm. </p>
  
  <pre><code>library(tm)
  
  corpus = Corpus(VectorSource(dat$Reviews))
  dtm = DocumentTermMatrix(corpus)
  </code></pre>
  
  <p>I used it to remove rare terms. </p>
  
  <pre><code>dtm = removeSparseTerms(dtm, 0.98)
  </code></pre>
  
  <p>After <code>removeSparseTerms</code>there are still some terms in the dtm which are useless for my analysis. </p>
  
  <p>The <code>tm</code> package has a function to remove words. However, this function can only be applied to a corpus or a vector. </p>
  
  <p>How can I remove defined terms from a dtm?</p>
  
  <p>Here is a small sample of the input data:</p>
  
  <pre><code>samp = dat %&gt;%
    select(Reviews) %&gt;%
    sample_n(20)
  
  dput(samp)
  structure(list(Reviews = c("buenisimoooooo", "excelente", "excelent", 
  "awesome phone awesome price almost month issue highly use blu manufacturer high speed processor blu iphone", 
  "phone multiple failure poorly touch screen 2 slot sim card work responsible disappoint brand good team shop store wine money unfortunately precaution purchase", 
  "work perfect time", "amaze buy phone smoothly update charm glte yet comparably fast several different provider sims perfectly small size definitely replacemnent simple", 
  "phone work card non sim card description", "perfect reliable kinda fast even simple mobile sim digicel never problem far strongly anyone need nice expensive dual sim phone perfect gift love friend", 
  "perfect", "great bang buck", "actually happy little sister really first good great picture late", 
  "good phone good reception home fringe area screen lovely just right size good buy", 
  "", "phone verizon contract phone buyer beware", "good phone", 
  "excellent product total satisfaction", "dreadful phone home button never screen unresponsive answer call easily month phone test automatically emergency police round supplier network nothing never electricals amazon good buy locally refund", 
  "good phone price fine", "phone star battery little soon yes"
  )), row.names = c(12647L, 10088L, 14055L, 3720L, 6588L, 10626L, 
  10362L, 1428L, 12580L, 5381L, 10431L, 2803L, 6644L, 12969L, 348L, 
  10582L, 3215L, 13358L, 12708L, 7049L), class = "data.frame")
  </code></pre>