Vizualizarea sentimentelor NRC
Am văzut cum vizualizările ne pot oferi o imagine mai clară asupra tiparelor din date decât simpla numărare. Să vizualizăm sentimentele din dicționarul nrc. Bibliotecile tidyverse și tidytext sunt deja încărcate pentru tine.
Acest exercițiu face parte din cursul
Introducere în analiza textului în R
Instrucțiuni pentru exercițiu
- Extrage dicționarul
nrc, numără sentimentele și reordonează-le după număr pentru a crea o nouă coloană factor,sentiment2. - Vizualizează
sentiment_countsfolosind noua coloană factor de sentimente. - Schimbă titlul în "Sentiment Counts in NRC", eticheta axei x în "Sentiment" și eticheta axei y în "Counts".
Exercițiu interactiv practic
Încearcă acest exercițiu completând acest cod de exemplu.
# Pull in the nrc dictionary, count the sentiments and reorder them by count
sentiment_counts <- ___(___) %>%
___(___) %>%
___(sentiment2 = ___(___, ___))
# Visualize sentiment_counts using the new sentiment factor column
___(___, aes(___, ___)) +
geom_col() +
coord_flip() +
# Change the title to "Sentiment Counts in NRC", x-axis to "Sentiment", and y-axis to "Counts"
___(
___ = ___,
___ = ___,
___ = ___
)