Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Filtering by row
Extracting data by column
15. Using contains()
Practice using filter() and select()
The pipe operator
Sorting rows


We can also select columns based on their contents. If we wanted all columns with the word "population" in their name, we could enter each column name ourselves.

But there's a better way: using the contains() function. The string we want to match goes inside the contains() function, which becomes the second argument in the select() function. If the column name matches the contents of contains(), it will be selected.

To select all columns with "population" in their names, we'd use:

select(countries, contains("population"))


Select columns with "area" in their name using contains().

Stuck? Here's a hint!


select(countries, contains("area"))