開始使用免費開始

建立文字雲

我們已看過長條圖,現在改用文字雲來視覺化詞頻吧!tidy_twitter 已經載入、斷詞並清理完成。

本練習屬於課程

R 文字分析入門

檢視課程

練習說明

  • 載入 wordcloud 套件。
  • 計算詞頻並指派給 word_counts
  • word_counts 的文字欄位指定給 words 參數。
  • word_counts 中的計數欄位(n)指定給 freq 參數。

動手互動練習

試著完成這個範例程式碼,體驗一下這個練習。

# Load the wordcloud package
___(___)

# Compute word counts and assign to word_counts
word_counts <- ___ %>% 
  ___(___)

wordcloud(
  # Assign the word column to words
  ___ = ___, 
  # Assign the count column to freq
  ___ = ___,
  max.words = 30
)
編輯並執行程式碼