Polaridad tidy con Bing: ¡Llámame Ismael (con ggplot2)!
¡El último ejercicio del léxico Bing! En este ejercicio usarás el operador pipe (%>%) para crear una línea temporal del sentimiento en Moby Dick.
Al final también crearás un gráfico sencillo siguiendo la estructura de código de abajo. En el siguiente capítulo profundizaremos en visualizaciones.
ggplot(pivoted_data, aes(index_column, polarity_column)) +
geom_smooth(se = FALSE)
Este ejercicio forma parte del curso
Análisis de sentimiento en R
ejercicio interactivo práctico
Prueba este ejercicio completando este código de ejemplo.
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,]