
28
■
2
章 整理データを使ったセンチメント分析
custom_stop_words
## # A tibble: 1,150
×
2
## word lexicon
## <chr> <chr>
## 1 miss custom
## 2 a SMART
## 3 a's SMART
## 4 able SMART
## 5 about SMART
## 6 above SMART
## 7 according SMART
## 8 accordingly SMART
## 9 across SMART
## 10 actually SMART
## # ... with 1,140 more rows
2.5
ワードクラウド
整理テキストマイニングのアプローチが
g
gplot2
とうまく適合することはすでに
紹介した通りですが、データを整理形式にしておくと、ほかのプロットでもうまく
使うことができます。
たとえば、
wordcloud
パッケージは、
R
がもともと持っているグラフィックス機
能を使っています。この
wordcloud
パッケージを使って、ジェーン・オースティン
の作品全体の最頻出語を改めて調べてみましょう(図2-5 参照)。
library(wordcloud)
tidy_books %>%
anti_join(stop_words) %>%
count(word) %>%
with(wordcloud(word, n, max.words = 100))