練習資料重塑
pivot_wider() 動詞可讓我們快速重塑或堆疊並轉置資料,讓後續 mutate() 更容易。
本練習屬於課程
R 文字分析入門
練習說明
- 將
tidy_twitter與 NRC 情感字典合併。 - 依抱怨標籤與情感進行計數。
- 將情感與計數欄位展開成寬表。
動手互動練習
試著完成這個範例程式碼,體驗一下這個練習。
tidy_twitter %>%
# Append the NRC sentiment dictionary
___(___) %>%
# Count by complaint label and sentiment
___(___) %>%
# Spread the sentiment and count columns
___(___, )