用条形图可视化高频术语
条形图是数据可视化中常见且高效的工具。
它能快速以图形方式概括类别及其对应的数值。
在本练习中,您将为文本语料库中出现的高频术语绘制条形图。
您之前为 "telemedicine" 构建的精炼文本语料库已预加载为 corp_refined。
本练习已预加载 qdap 和 ggplot2 库。
本练习是课程的一部分
用 R 分析社交媒体数据
交互式实操练习
通过完成这段示例代码来试试这个练习。
# Extract term frequencies for the top 10 words
termfreq_10w <- ___(corp_refined, ___)
termfreq_10w
# Identify terms with more than 60 counts from the top 10 list
term60 <- subset(termfreq_10w, ___ > ___)
# Create a bar plot using terms with more than 60 counts
ggplot(___, aes(x = reorder(___, -___), y = FREQ)) +
geom_bar(stat = "identity", fill = "red") +
theme(axis.text.x = element_text(angle = 15, hjust = 1))