First, we call sort with index.return=TRUE. This sorts the values
returns a list with two components: a double vector named x, which
contains the values of bikedata$passing.distance sorted in
increasing order, and an integer vector named ix, which contains the
indices of these values.

We extract the component of the result names ix with the $ix
operator.

Then, we take elements 1:5 and store them in shortest. These
are the indices of the 5 smallest values, not the values themselves.

Finally, with the command bikedata[shortest,], we ask for
the rows indicated by shortest and all columns of the data frame.

To get the longest passing distance, we can modify the original code,
adding decreasing=TRUE to the call to sort: