Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close


Extracting columns from a data frame is just as simple as retrieving rows. Recall that indexes listed before the comma in the bracket operator are used for rows. In a similar fashion, indexes listed after the comma are used to denote the column you’d like to retrieve. In this case, we start with a comma and then provide the index of the column we want to retrieve:

people[ ,1]


Retrieve the second column from the cars data frame.

Stuck? Here's a hint!


cars[ ,2]