Last call! Check what courses we have in our offer, and get them all here to save $727 (only hours left.)
Introduction to data frames
Data frame structure
Accessing columns in a data frame
Accessing rows of a data frame
Accessing rows and columns combined in a data frame
Data frame analysis


Great! So far, you've learned how to filter rows based on a single condition.

However, you'll sometimes want to use more than one condition for row filtering. In that case, you can use logical operators (& and |) to combine multiple conditions.

For example, if you want to retrieve cities from Germany that have more than 1 million people, you can combine two conditions like this:

cities[cities$country == "Germany" & cities$population > 1000000, ]

Inside the brackets and before the comma, we defined two conditions: cities$country == "Germany" and cities$population > 1000000. We combine them together with the logical "and" operator (&). This ensures that R displays only the rows that match both conditions.


From the countries data frame, extract only those rows (countries) that are from WESTERN EUROPE and that have more than 50 million people. These are perfect countries for Versico's expansion!

Stuck? Here's a hint!

Inside [...], before the comma, define two conditions:

countries$region == "WESTERN EUROPE"


countries$population > 50000000

Combine these two conditions with the logical "and" (&) operator.