Data Cornering
Here are two methods how to get the previous or next record in the R data frame. One of them is better in large data frames, but the other is more compact.