Select columns from a data frame

To select only a specific set of interesting data frame columns dplyr offers the select() function to extract columns by names, indices and ranges. You can even rename extracted columns with select().

  • Learn to use the select() function
  • Select columns from a data frame by name or index
  • Rename columns from a data frame
select(my_data_frame, column_one, column_two, ...)
select(my_data_frame, new_column_name = current_column, ...)
select(my_data_frame, column_start:column_end)
select(my_data_frame, index_one, index_two, ...)
select(my_data_frame, index_start:index_end)
View Interactive Version