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
Summary

Instruction

Nice work! You've learned how to extract rows from a data frame.

Now, let's see how we can use those filtered values in further data analysis. We do so by first filtering the data frame to produce a subset of the original data. Then, we simply invoke nrow() on that subset to determine how many rows there are!

For example, after you filter the cities data frame to those cities whose populations are greater than one million, you can use the nrow() function to determine how many cities match that condition, like so:

nrow(cities[cities$population > 1000000, ])

Exercise

How many countries from the countries data frame are from WESTERN EUROPE? Use nrow() on filtered rows to answer this question.

Stuck? Here's a hint!

Nest the row filtering inside the nrow() function.