Get startedGet started for free

Visualizing word counts with facets

The word_counts from the previous exercise have been loaded. Let's visualize the word counts for the Twitter data with separate facets for complaints and non-complaints.

This exercise is part of the course

Introduction to Text Analysis in R

View Course

Exercise instructions

  • Include a color aesthetic tied to whether or not its a complaint.
  • Don't include the legend for the column plot.
  • Facet by whether or not the tweet comes from a complaint and make the y-axis free.
  • Flip the coordinates and add a title: "Twitter Word Counts".

Hands-on interactive exercise

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

# Include a color aesthetic tied to whether or not its a complaint
ggplot(word_counts, aes(x = word2, y = n, ___)) +
  # Don't include the lengend for the column plot
  geom_col(___) +
  # Facet by whether or not its a complaint and make the y-axis free
  ___(___, scales = ___) +
  # Flip the coordinates and add a title: "Twitter Word Counts"
  ___() +
  ___(___)
Edit and Run Code