Kickstart 2020 with new opportunities! - hours only!Up to 80% off on all courses and bundles.-Close
Introduction
Filtering by row
Extracting data by column
Practice using filter() and select()
19. Subsetting rows and columns
The pipe operator
Sorting rows
Summary

Instruction

Did you notice what we did? First, we filtered rows and assigned the results to a variable. Then, we selected columns. But actually, we can do all this in one step.

First, we will filter the Asian countries:

filter(countries, continent == "Asia")

From this set, we can choose the population and area columns. All together, this looks like:

select(filter(countries, continent == "Asia"), population, area)

Exercise

Select the population and area columns for all South American countries.

Stuck? Here's a hint!

Type:

select(filter(countries, continent == "South America"), population, area)