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

Instruction

Well done! But we can take a shortcut: we can use the %in% operator instead of spelling out country_name=='Canada' and country_name=='Italy'. The %in% operator looks for a value in a given vector. So we'd write:

filter(countries, country_name %in% c("Canada", "Italy"))

Exercise

Select data about Spain and Zimbabwe using %in%.

Stuck? Here's a hint!

Type:

filter(countries, country_name %in% c("Spain", "Zimbabwe"))