Bing tidy polarity: Call me Ishmael (with ggplot2)!
The last Bing lexicon exercise! In this exercise you will use the pipe operator (%>%) to create a timeline of the sentiment in Moby Dick.
In the end you will also create a simple visual following the code structure below. The next chapter goes into more depth for visuals.
ggplot(pivoted_data, aes(index_column, polarity_column)) +
geom_smooth(se = FALSE)
Este exercício faz parte do curso
Sentiment Analysis in R
Exercício interativo prático
Experimente este exercício completando este código de exemplo.
moby_polarity <- moby %>%
# Inner join to lexicon
___(bing, by = c("___" = "___")) %>%
# Count the sentiment scores
___(___, ___) %>%
# Pivot the sentiment into positive and negative columns
___(names_from = ___, values_from = ___, values_fill = ___) %>%
# Add polarity column
mutate(___ = ___ - __) %>% arrange(index)
# Examine a portion
moby_polarity[190:195,]