Save up to $499! Grab all Python courses for $49 or all online courses we’ve ever launched for only $169. Only Feb 11-16. Happy Valentine's!
Filtering by row
Extracting data by column
11. Select a range of columns
Practice using filter() and select()
The pipe operator
Sorting rows


The dplyr package has lots of convenient ways to specify which columns to select. What if we want to select a range of columns? We'd use a colon (:) to define the columns we want. Important: Think of the colon as meaning "from ... to". For this operator to work, the columns we select must be in a continuous group.

So, if we wanted the first three columns in countries, we'd write:

select(countries, 1:3)


Select columns three to five from countries.

Stuck? Here's a hint!


select(countries, 3:5)