While creating the wordcloud it is also taking metadata from Corpus

I have attached the image, it is showing character ( which the metadata in the wordcloud)

Below is the code
</
tweetaccount<-str_extract_all(trendingtweets.df$text,"@\w++")
namesCorpus<-Corpus(VectorSource(tweetaccount))
set.seed(42)
Rplot01 wordcloud(words = namesCorpus,scale = c(4,.5), max.words = 100,random.order = FALSE,rot.per = .10,random.color = FALSE,colors = pal, use.r.layout =FALSE)

/>

If you want to remove stopwords from your namesCorpus object consider this code somewhere between defining it and running the wordcloud

stopwords <- c("character") # add more as required...
namesCorpus <- setdiff(namesCorpus, stopwords)

Thank you for the help! I have used the stopword but is is taking out the entire list. Is their anything else I can try.

You will need to share more of your code to help us help you.

In the meantime consider this reproducible example - first call is a "bad wordcloud" with character included, second is a "good wordcloud" with character removed.

In the process I use the setdiff function from base R to calculate the difference between vector of raw tokens, and a vector of stopwords.

words <- c("dog", "cat", "character", "character")

stopwords <- c("character")

words_mod <- setdiff(words, stopwords)

wordcloud::wordcloud(words)  # bad cloud!

wordcloud::wordcloud(words_mod)  # good cloud! :)

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.