Visualize popular terms with bar plots
Bar plot is a simple yet popular tool used in data visualization.
It quickly helps summarize categories and their values in a visual form.
In this exercise, you will create bar plots for the popular terms appearing in a text corpus.
The refined text corpus that you created for "telemedicine"
has been pre-loaded as corp_refined
.
The libraries qdap
and ggplot2
have been pre-loaded for this exercise.
This exercise is part of the course
Analyzing Social Media Data in R
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Extract term frequencies for the top 10 words
termfreq_10w <- ___(corp_refined, ___)
termfreq_10w
# Identify terms with more than 60 counts from the top 10 list
term60 <- subset(termfreq_10w, ___ > ___)
# Create a bar plot using terms with more than 60 counts
ggplot(___, aes(x = reorder(___, -___), y = FREQ)) +
geom_bar(stat = "identity", fill = "red") +
theme(axis.text.x = element_text(angle = 15, hjust = 1))