I have two data.frames each with three columns: chrom, start & stop, let\'s call them rangesA and rangesB. For each row of rangesA, I\'m looking to find which (if any)
I add the dplyr solution.
dplyr
library(dplyr) inner_join(rangesA, rangesB, by="chrom") %>% filter(start.y < start.x | stop.y > stop.x)
Output:
chrom start.x stop.x start.y stop.y 1 5 100 105 99 106 2 1 200 250 200 265