Ell
Ell

Reputation: 109

How to remove Stopwords using %in% operator

I have a list of words in a dataset .

My question: Any idea how to fix the following code?

new_words <- c("it", "apple", "carrot", "after",
 "snake")
# My first solution
removeWords(new_words,
 words = stopwords (kind = "en")
# I have a problem in the Second solution,
# because I want to use #%in% operator
new_words[new_words %in%
 words = stopwords(kind = "en")]

Upvotes: 3

Views: 86

Answers (1)

the_real_alex_dee
the_real_alex_dee

Reputation: 9

why not just anti_join(stop_words)?

that's how Julia Silge does it in Text Mining for R... https://www.tidytextmining.com/index.html

Upvotes: 1

Related Questions