按产品计数并重新排序
tidy_twitter 已完成分词,并移除了停用词(包括自定义停用词)。您希望基于投诉与非投诉来可视化词频差异。
本练习是课程的一部分
R 文本分析入门
练习说明
- 按是否为投诉来统计词频。
- 按是否为投诉保留前 20 个高频词。
- 在将单词按计数作为因子重新排序之前,先取消分组。
交互式实操练习
通过完成这段示例代码来试试这个练习。
word_counts <- tidy_twitter %>%
# Count words by whether or not its a complaint
___(___, ___) %>%
# Group by whether or not its a complaint
group_by(___) %>%
# Keep the top 20 words
___(___, ___) %>%
# Ungroup before reordering word as a factor by the count
___() %>%
___(word2 = ___(___, ___))