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

Instruction

Now we come to one advantage of dplyr over base R: dplyr allows us to exclude columns by name. We simply replace the position number with the column name. So to select all columns except continent, we'd write:

select(countries, -continent)

Exercise

Select all columns except population from countries.

Stuck? Here's a hint!

Type:

select(countries, -population)