Comece agoraComece grátis

Bing tidy polarity: Call me Ishmael (com ggplot2)!

O último exercício com o léxico Bing! Neste exercício, você vai usar o operador pipe (%>%) para criar uma linha do tempo do sentimento em Moby Dick. No final, você também vai criar um visual simples seguindo a estrutura de código abaixo. O próximo capítulo aprofunda os visuais.

ggplot(pivoted_data, aes(index_column, polarity_column)) +
  geom_smooth(se = FALSE)

Este exercicio faz parte do curso

Análise de Sentimentos em R

Ver curso

exercicio interativo prático

Tente este exercicio 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,]
Editar e Executar Código