Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Filtering by row
Extracting data by column
Practice using filter() and select()
The pipe operator
Sorting rows
26. Exercise 1


Before we go on, let's have a quick summary. We're going to use everything we've learned to make one long instruction! What have we learned so far?

We've learned to select some columns from a tibble:

select(countries, continent)

We've learned to filter selected rows using a condition:

filter(countries, country_name == "France")

We've learned how to sort the results:

arrange(countries, area)

And we've learned to use the pipe operator to increase the readability of code:

countries %>%
  select(continent, area) %>%
  filter(continent == "Africa") %>%


Filter all countries in Africa and North America.

Stuck? Here's a hint!


countries %>%
  filter(continent %in% c("Africa", "North America"))