CommencerCommencer gratuitement

Plot the better word cloud

Now that you've removed additional stopwords let's take a look at the improved word cloud!

The term-document matrix from the previous exercise has been turned into matrix with as.matrix(), then a named vector was created with rowSums(). This new object of term frequencies called chardonnay_words is preloaded into your workspace. Let's take a look at these new word cloud results.

Cet exercice fait partie du cours

Text Mining with Bag-of-Words in R

Afficher le cours

Instructions

We've loaded the wordcloud package for you behind the scenes and will do so for all additional exercises requiring it.

  • Sort the values in chardonnay_words with decreasing = TRUE. Save as sorted_chardonnay_words.
  • Look at the top 6 words in sorted_chardonnay_words and their values.
  • Create terms_vec using names() on chardonnay_words.
  • Pass terms_vec and chardonnay_words into the wordcloud() function. Review what other words pop out now that "chardonnay" is removed.

Exercice interactif pratique

Essayez cet exercice en complétant cet exemple de code.

# Sort the chardonnay_words in descending order
___ <- ___(___, ___)

# Print the 6 most frequent chardonnay terms
___(___)

# Get a terms vector
___ <- ___(___)

# Create a wordcloud for the values in word_freqs
wordcloud(___, ___, 
          max.words = 50, colors = "red")
Modifier et exécuter le code