Get startedGet started for free

Reordering graphs

The graph you built in the last exercise was readable, but it would be easier to understand it at a glance if it was ordered. Let's use some forcats functions to change the graph so it's ordered in descending order of average usefulness from left to right.

The dataset usefulness_by_platform has been loaded for you.

This exercise is part of the course

Categorical Data in the Tidyverse

View Course

Exercise instructions

  • Order learning_platform in the graph by avg_usefulness so that, from left to right, it goes from highest usefulness to lowest.

Hands-on interactive exercise

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

usefulness_by_platform %>%
	# Reorder learning_platform by avg_usefulness
	mutate(learning_platform = ___(___, ___)) %>%
	# Reverse the order of learning_platform
	mutate(learning_platform = ___) %>%
	ggplot(aes(x = learning_platform, y = avg_usefulness)) + 
	geom_point() + 
    theme(axis.text.x = element_text(angle = 90, hjust = 1)) + 
    labs(x = "Learning Platform", y = "Percent finding at least somewhat useful") + 
    scale_y_continuous(labels = scales::percent_format())
Edit and Run Code