# How to create a black and white word cloud in R?

According to Google, a word cloud is an image composed of words used in a particular text or subject, in which the size of each word indicates its frequency or importance. In R, we can create word cloud by using wordcloud function of wordcloud package. So, we have the same name of the function as the package, thus we should not get confused by it.

library("wordcloud")
x<-c("tutorialspoint is one of the best free resources for online learning")
wordcloud(x)

Warning messages −

• In tm_map.SimpleCorpus(corpus, tm::removePunctuation) −

transformation drops documents

• In tm_map.SimpleCorpus(corpus, function(x) tm::removeWords(x, tm::stopwords())) −

transformation drops documents

## Output

Let’s have a look at another example −

y<-c("covid-19 has changed almost everything that happens around the world")
wordcloud(y)

Warning messages −

• In tm_map.SimpleCorpus(corpus, tm::removePunctuation) −

transformation drops documents

• In tm_map.SimpleCorpus(corpus, function(x) tm::removeWords(x, tm::stopwords())) −

transformation drops documents