CommencerCommencer gratuitement

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.

Cet exercice fait partie du cours

Introduction to Text Analysis in R

Afficher le cours

Instructions

  • 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.

Exercice interactif pratique

Essayez cet exercice en complétant cet exemple de 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
  ___()
Modifier et exécuter le code