Aan de slagGa gratis aan de slag

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.

Deze oefening maakt deel uit van de cursus

Introduction to Text Analysis in R

Cursus bekijken

Oefeninstructies

  • Only keep the words with counts greater than 100.
  • Create a bar plot using word_counts with word mapped to the x-axis.
  • Flip the plot coordinates.

Praktische interactieve oefening

Probeer deze oefening eens door deze voorbeeldcode in te vullen.

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
  ___()
Code bewerken en uitvoeren