棒グラフで人気の用語を可視化する
棒グラフは、データ可視化でよく使われるシンプルで人気の高いツールです。
カテゴリとその値を視覚的に手早く要約できます。
この演習では、テキストコーパスに出現する人気の用語について、棒グラフを作成します。
あなたが "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))