Adding custom stopwords in R tm

Brian picture Brian · Aug 26, 2013 · Viewed 33.4k times · Source

I have a Corpus in R using the tm package. I am applying the removeWords function to remove stopwords

tm_map(abs, removeWords, stopwords("english")) 

Is there a way to add my own custom stop words to this list?

Answer

James picture James · Aug 26, 2013

stopwords just provides you with a vector of words, just combine your own ones to this.

tm_map(abs, removeWords, c(stopwords("english"),"my","custom","words"))