Nov 29, 2016 · However, we would only need the observations from the rows that correspond to Region 2. Here’s the basic way to retrieve that data in R: ed_exp1 <- education[c(10:21),c(2,6:7)] To create the new data frame ‘ed_exp1,’ we subsetted the ‘education’ data frame by extracting rows 10-21, and columns 2, 6, and 7. Pretty simple, right? In the above examples, I showed you how to compare two columns (or lists) when we are just comparing side by side cells. In reality, this is rarely going to be the case. In most cases, you will have two columns with data and you would have to find out whether a data point in one column exists in the other column or not.