Visualizing complaints
We ended the last chapter with complaint word counts. Now let's visualize those word counts with a bar plot.
The tidyverse and tidytext packages have been loaded. twitter_data has been tokenized and the standard stop words have been removed.
This exercise is part of the course
Introduction to Text Analysis in R
Exercise instructions
- Only keep the words with counts greater than 100.
 - Create a bar plot using 
word_countswithwordmapped to the x-axis. - Flip the plot coordinates.
 
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
word_counts <- tidy_twitter %>% 
  filter(complaint_label == "Complaint") %>% 
  count(word) %>% 
  # Keep words with count greater than 100
  ___(___)
# Create a bar plot using word_counts with x = word
ggplot(___, aes(___, ___)) +
  geom_col() +
  # Flip the plot coordinates
  ___()