開始使用免費開始

視覺化抱怨內容

上一章我們得到抱怨用詞的計數。現在用長條圖把這些詞頻視覺化。

已載入 tidyversetidytext 套件。twitter_data 已完成斷詞,且已移除一般常見的停用字。

本練習屬於課程

R 文字分析入門

檢視課程

練習說明

  • 只保留計數大於 100 的單字。
  • 使用 word_counts 建立長條圖,將 word 對應到 x 軸。
  • 翻轉圖形座標。

動手互動練習

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

word_counts <- tidy_twitter %>% 
  filter(complaint_label == "Complaint") %>% 
  count(word) %>% 
  # Keep words with count greater than 100
  ___(___)

# Create a bar plot using word_counts with x = word
ggplot(___, aes(___, ___)) +
  geom_col() +
  # Flip the plot coordinates
  ___()
編輯並執行程式碼