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

Instruction

We can use more than one condition with filter(). Just use a comma (,) after each condition; filter() will interpret the comma as an and operator.

If we wanted to subset African countries with areas greater than or equal to 1,000 square kilometers, we would write:

filter(countries, continent == "Africa", area >= 1000)

Exercise

Subset Asian countries that are less than 500 square kilometers in area.

Stuck? Here's a hint!

Type:

filter(countries, continent == "Asia", area < 500)