因子を使って単語数を可視化する
いくつかのカスタムストップワード(航空会社名を含む)を追加し、データは整形済みです。ここからは、改良版の可視化を作成し、単語数の多い順に並べたプロットを作りましょう。
この演習はコースの一部です
Rで始めるテキスト分析
演習の手順
non_complaintsの中で100回より多く出現する用語だけを残してください。word列を、単語の出現数で順序付けられた因子として並べ替えてください。- 新しい因子型の単語列を使って棒グラフを作成してください。
実践的なインタラクティブ演習
このサンプルコードを完成させて、この演習に挑戦してみましょう。
word_counts <- tidy_twitter %>%
filter(complaint_label == "Non-Complaint") %>%
count(word) %>%
# Keep terms that occur more than 100 times
___(___) %>%
# Reorder word as an ordered factor by word counts
___(word2 = ___(___, ___))
# Plot the new word column with type factor
___(___, aes(___, ___)) +
___() +
___() +
ggtitle("Non-Complaint Word Counts")