Press "Enter" to skip to content

Selecting by Index in R

Steven Sanderson grabs some rows:

Imagine you want to analyze the fuel efficiency (miles per gallon) of a particular car. Here’s how to grab a single row by its index (row number):

Read on for that example, as well as examples covering two other cases: multiple rows based on index value, and ranges of indices.