Get startedGet started for free

Practicing reshaping data

The pivot_wider() verb allows us to quickly reshape or stack and transpose our data, making it easier to mutate().

This exercise is part of the course

Introduction to Text Analysis in R

View Course

Exercise instructions

  • Append tidy_twitter to the NRC sentiment dictionary.
  • Count by complaint label and sentiment.
  • Widen the sentiment and count columns.

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

tidy_twitter %>% 
  # Append the NRC sentiment dictionary
  ___(___) %>% 
  # Count by complaint label and sentiment
  ___(___) %>% 
  # Spread the sentiment and count columns
  ___(___, )
Edit and Run Code