建立文字雲
我們已看過長條圖,現在改用文字雲來視覺化詞頻吧!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
)