CommencerCommencer gratuitement

Counting the NRC sentiments

The fourth dictionary included with the tidytext package is the nrc dictionary. Let's start our exploration with sentiment counts.

Cet exercice fait partie du cours

Introduction to Text Analysis in R

Afficher le cours

Instructions

  • I usually do this for you, but start with loading the tidyverse and tidytext packages.
  • Count the number of words associated with each sentiment in nrc.
  • Arrange the counts in descending order.

Exercice interactif pratique

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

# Load the tidyverse and tidytext packages
___(___)
___(___)

# Count the number of words associated with each sentiment in nrc
___(___) %>% 
  ___(___) %>% 
  # Arrange the counts in descending order
  ___(___)
Modifier et exécuter le code