CommencerCommencer gratuitement

Visualiser le sentiment

Créons un jeu de données word_counts et explorons quels mots sont associés à chaque sentiment dans nos données Twitter.

Cet exercice fait partie du cours

Introduction à l’analyse de texte en R

Afficher le cours

Exercice interactif pratique

Essayez cet exercice en complétant cet exemple de code.

word_counts <- tidy_twitter %>% 
  # Append the NRC dictionary and filter for positive, fear, and trust
  ___(___) %>% 
  ___(___) %>%
  # Count by word and sentiment and keep the top 10 of each
  ___(___) %>% 
  group_by(___) %>% 
  ___(___) %>% 
  ungroup() %>% 
  # Create a factor called word2 that has each word ordered by the count
  mutate(___)
Modifier et exécuter le code