First off, I'm pretty new to R, and this board, so please bear with me.
I have 2 data frames, and I want to use one to search the second. Specifically, I want a list of var from x where x$pos==y$chr
and x$loc
is within the range of start and end in y for each row.
Ideal output would be something like
rs1234 chr11 872365 bingo 872000 873000
rs2314 chr12 881000 boom 880000 881100
Any suggests are much appreciated!
> x
var pos loc
1 rs1234 chr11 872365
2 rs2341 chr12 881000
3 rs3412 chr11 872010
4 rs4123 chr1 186543
> y
chr start end name
1 chr11 872000 873000 bingo
2 chr11 873100 874000 batta
3 chr12 880000 881100 boom