시작하기무료로 시작하기

A simple word cloud

At this point, you have had too much coffee. Plus, seeing the top words such as "shop", "morning", and "drinking" among others just isn't all that insightful.

In celebration of making it this far, let's try our hand on another batch of 1000 tweets. For now, you won't know what they have in common, but let's see if you can figure it out using a word cloud. The tweets' term frequency values are preloaded in your workspace.

A word cloud is a visualization of terms. In a word cloud, size is often scaled to frequency, and in some cases, the colors may indicate another measurement. For now, we're keeping it simple: size is related to individual word frequency, and we are just selecting a single color.

As you saw in the video, the wordcloud() function works like this:

wordcloud(words, frequencies, max.words = 500, colors = "blue")

Text mining analyses often include simple word clouds. In fact, they are probably overused, but can still be useful for quickly understanding a body of text!

term_frequency is loaded into your workspace.

이 연습은 강의의 일부입니다

Text Mining with Bag-of-Words in R

강의 보기

연습 안내

  • Load the wordcloud package.
  • Print out first 10 entries in term_frequency.
  • Extract the terms using names() on term_frequency. Call the vector of strings terms_vec.
  • Create a wordcloud() using terms_vec as the words, and term_frequency as the values. Add the parameters max.words = 50 and colors = "red".

실습형 인터랙티브 연습

이 예제를 이 샘플 코드를 완성하여 풀어보세요.

# Load wordcloud package


# Print the first 10 entries in term_frequency


# Vector of terms


# Create a word cloud for the values in word_freqs
코드 편집 및 실행