I have the following two dataframes:
df1:
column_01 column_02
a 3
b 7
df2:
column_01 column_02 column_03 column_04
a 1 4 a-low
a 5 8 a-high
b 1 4 b-low
b 5 8 b-high
I have to merge df1 with column_04 of df2, where column_01 of df1 matches column_01 of df2 AND column_02 of df1 has to be between the values of df2 column_02 and column_03. The result would be:
df_result:
column_01 column_02 column_03
a 3 a-low
b 7 b-high
In sql it would be a join with a between clause. But how can I get this done in R?