I need to do the following process using R: 1)I have a df1 that looks
Chrom | Start | End |
---|---|---|
1 | 0 | 30 |
1 | 50 | 80 |
1 | 100 | 140 |
2 | 20 | 40 |
2 | 60 | 100 |
2 | 110 | 130 |
2)And a df2 that looks
Chrom | TAG | Position |
---|---|---|
1 | AX-1020 | 55 |
2 | AX-1320 | 75 |
3)So, I would like to add info from df2 into df1 using the interval between Start and End in df1 and Position in df2 as I show here
Chrom | Start | End | TAG | Position |
---|---|---|---|---|
1 | 0 | 30 | NA | NA |
1 | 50 | 80 | AX-1020 | 55 |
1 | 100 | 140 | NA | NA |
2 | 20 | 40 | NA | NA |
2 | 60 | 100 | AX-1320 | 75 |
2 | 110 | 130 | NA | NA |
I hope anyone can help me. I'd appreaciate a lot!