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!
Getting started with tibbles
Creating tibbles
Subsetting
12. Extract columns by position and [[
Summary

Instruction

We can also use [[ to extract columns by their position in the tibble. In the employees tibble, the department column is the 4th column. To extract it, we enter:

employees[[4]]

Exercise

Extract the product column from orders using [[ and its position number.

Stuck? Here's a hint!

Products are in the 5th column of the orders tibble.

Type:

orders[[5]]