LoslegenKostenlos loslegen

Visualize common words

Now that you have a corpus filled with words used in both the chardonnay and coffee tweets files, you can clean the corpus, convert it into a TermDocumentMatrix, and then a matrix to prepare it for a commonality.cloud().

The commonality.cloud() function accepts this matrix object, plus additional arguments like max.words and colors to further customize the plot.

commonality.cloud(tdm_matrix, max.words = 100, colors = "springgreen")

Diese Übung ist Teil des Kurses

Text Mining with Bag-of-Words in R

Kurs anzeigen

Anleitung zur Übung

  • Create all_clean by applying the predefined clean_corpus() function to all_corpus.
  • Create all_tdm, a TermDocumentMatrix from all_clean.
  • Create all_m by converting all_tdm to a matrix object.
  • Create a commonality.cloud() from all_m with max.words = 100 and colors = "steelblue1".

Interaktive Übung

Versuche dich an dieser Übung, indem du diesen Beispielcode vervollständigst.

# Clean the corpus
___ <- ___(___)

# Create all_tdm
___ <- ___(___)

# Create all_m
___ <- ___(___)

# Print a commonality cloud
___(___, ___, ___)
Code bearbeiten und ausführen