It's not exactly the same result as you gave in your question, but the code below joins table 1 and table 2 on Date and Q. Maybe this helps already.
library(tidyverse)
tab1 <- data.frame(
stringsAsFactors = FALSE,
check.names = FALSE,
Sno = c(1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L),
Date = c("10/12/2001",
"10/13/2001","10/14/2001","10/15/2001",
"10/16/2001","10/17/2001","10/18/2001","10/19/2001",
"10/20/2001","10/21/2001"),
Q = c(106L,109L,98L,
131L,133L,119L,125L,96L,101L,44L),
`Volume(d)` = c(200L,50L,133L,
122L,143L,200L,121L,230L,500L,300L)
)
tab2 <- data.frame(
stringsAsFactors = FALSE,
check.names = FALSE,
Sno = c(1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L),
Date = c("10/12/2001",
"10/13/2001","10/14/2001","10/15/2001",
"10/16/2001","10/17/2001","10/18/2001","10/19/2001"),
Q = c(106L, 109L, 98L, 131L, 133L, 119L, 125L, 96L),
`area(sf)` = c(500L,2000L,
450L,800L,900L,1456L,2000L,3000L)
)
tab_overlap <- tab1 %>%
left_join(., tab2,
by=c("Date", "Q"))
tab_overlap
#> Sno.x Date Q Volume(d) Sno.y area(sf)
#> 1 1 10/12/2001 106 200 1 500
#> 2 2 10/13/2001 109 50 2 2000
#> 3 3 10/14/2001 98 133 3 450
#> 4 4 10/15/2001 131 122 4 800
#> 5 5 10/16/2001 133 143 5 900
#> 6 6 10/17/2001 119 200 6 1456
#> 7 7 10/18/2001 125 121 7 2000
#> 8 8 10/19/2001 96 230 8 3000
#> 9 9 10/20/2001 101 500 NA NA
#> 10 10 10/21/2001 44 300 NA NA
Created on 2022-05-11 by the reprex package (v2.0.1)