A post with the inverse problem has been asked before, but the same function does not apply.
Consider these two databases.
df1<- data.frame(TypeA=paste0("A",1:3), Position=c(1, 5, 9))
df2<- data.frame(TypeB=paste0("B",1:5),StartPosition=c(0, 3, 7, 8, 20), EndPosition=c(2, 4, 8, 18, 25))
How can I obtain the rows in df2 whose range (between StartPosition and EndPosition) includes the value (Position) in df1?
One would expect:
TypeB StartPosition EndPosition TypeA
B1 0 2 A1
B4 8 18 A3