title: R's tm package for word count
body: <p>I have a corpus with over 5000 text files. I would like to get individual word counts for each file after running pre-processing each (turning to lower, removing stopwords, etc). I haven't had any luck with the word count for the individual text files. Any help would be appreciated.</p>
  
  <pre><code>library(tm)
  revs&lt;-Corpus(DirSource("data/")) 
  revs&lt;-tm_map(revs,tolower) 
  revs&lt;-tm_map(revs,removeWords, stopwords("english")) 
  revs&lt;-tm_map(revs,removePunctuation) 
  revs&lt;-tm_map(revs,removeNumbers) 
  revs&lt;-tm_map(revs,stripWhitespace) 
  dtm&lt;-DocumentTermMatrix(revs) 
  </code></pre>