Filtering by row
4. Subset rows: logical operators
Extracting data by column
Practice using filter() and select()
The pipe operator
Sorting rows


What if we want to use logical operators on filter()? We can do that. Just include logical operators in the filtering statements. If we wanted to see information about Canada and Italy, we'd write:

filter(countries, country_name == "Canada" | country_name == "Italy")

Note: We're using the | operator here (remember, | is the or operator in R), which will return a result if either condition is true.


Find information about the United States and Finland from countries.

Stuck? Here's a hint!


filter(countries, country_name == "United States" | country_name == "Finland")