Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Introduction
Filtering by row
2. Subset rows: single condition
Extracting data by column
Practice using filter() and select()
The pipe operator
Sorting rows
Summary

Instruction

We've seen some of our data and know what to expect. Let's begin using dplyr.

First, we'll learn a new way of filtering rows: the filter() function. Suppose we only want to see information about Panama. We'd write:

filter(countries, country_name == "Panama")

Notice that the name of the dataset is the first argument. Next, we have the filtering conditions. In this case, we want the information in the country_name column to equal "Panama".

Important: Don't include single (') or double quotes (") around the column name.

Exercise

Get information about France from countries. The column name is country_name.

Stuck? Here's a hint!

Type:

filter(countries, country_name == "France")