Only this week, get the SQL Complete Track of 9 courses in a special prize of $330 $89!
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)