[Solved] Removing different words form a document using R console


A simple way would be to use

gsub(paste0('\\b',
            YOURVECTOROFWORDSTOREMOVE,
            '\\b', collapse="|"),'',YOURSTRING)

which replaces every occurence of the words in the vector surrounded by either end/beginning characters or whitespace with a single space.

but you might want to look at the tm package and work with a corpus object if you have many files like this. there you can remove the words you like simply with

tm_map(YOURCORPUS, removeWords, YOURVECTOROFWORDSTOREMOVE) 

2

solved Removing different words form a document using R console