Introduction

Instruction

Now, suppose we want to look at a particular row of our data frame. All we need to do is provide the index of the row in brackets, followed by a comma. For example, to extract the second row, we’d write:

people[2, ]

Just like vectors, rows in a data frame are indexed from 1.

Exercise

Extract the first row of the cars data frame.

Stuck? Here's a hint!

Type:

cars[1, ]