I have a question similar to this one:
Add column(Annotate) one data frame based on column from other data frame in R
Where I have two files as such:
head(geno)
chr Pos Val
X 129271111 10
X 129271112 10
X 129271113 10
X 129271114 10
X 129271115 10
And
head(anno)
chr Annot start end
X promo 129271053 129271110
X Fx12 129270618 129270706
X Txw 129270020 129270160
X Tx3 129267288 129267430
X Tx5 129265650 129265774
And I would like to add a 4th column (Annot from the second file) to the first file based on whether the Pos variable lies between the start and end of the second file.
The only thing I can think of is using a loop to do this and that seems like a real waste of time as the files are so large.
Can someone please provide some advise on how to do this in a tidyverse/dplyr way?
Thank you,