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

Instruction

Okay, but realistically, we probably want to exclude rows with missing data. The ! operator can do this. We simply add it to the is.na() function like this: !is.na(). This will return TRUE only if the data is not NA. Suppose we want to see urban population data without any missing values. We'd put:

filter(countries, !is.na(urban_population))

Exercise

Subset all rows without missing values from the water_area column.

Stuck? Here's a hint!

Type:

filter(countries, !is.na(water_area))