ComeçarComece de graça

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.

Este exercício faz parte do curso

Introduction to Text Analysis in R

Ver curso

Instruções do exercício

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

Exercício interativo prático

Experimente este exercício completando este código de exemplo.

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
  ___()
Editar e executar o código