Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Introduction
Filtering by row
Extracting data by column
Practice using filter() and select()
The pipe operator
Sorting rows
25. Sort in descending order
Summary

Instruction

Great! But what if we want our data in reverse order? Then we use desc() inside the arrange() function. If we wanted to see a list of European countries with the least-populated ones first, we'd write:

countries %>%
  filter(continent == "Europe") %>%
  arrange(desc(population))

Exercise

Select countries from Africa, and sort the results in descending order by area.

Stuck? Here's a hint!

Type:

countries %>%
  filter(continent == "Africa") %>%
  arrange(desc(area))