I have two different datasets as follows:

I need to add the call volume, put volume, and total volume columns in dataset #2 if and only if: Both ID and Date columns in both datasets match. I am separating calls, puts, and totals, based on the values in column 3 in dataset #1 (C for calls, P for puts, and T for total).
I am running this code but it isn't working (showing an example of calls only, same rule applies for puts and totals).
dataset2$call_volume <- if(dataset1$optiontype== "C")
{ dataset1$volume [ match (
interaction(dataset2$ID,dataset2$date),
interaction(dataset1$ID,dataset1$date)
)]}
Does anyone have a suggestion of how I could proceed with the code? Many thanks!
> dput(dataset1)
structure(list(ID = c(44652, 44652, 44652, 56266, 56266, 56266,
44652, 44652, 44652, 56266, 56266, 56266), date = c("1997/01/02",
"1997/01/02", "1997/01/02", "1997/01/02", "1997/01/02", "1997/01/02",
"1997/01/03", "1997/01/03", "1997/01/03", "1997/01/03", "1997/01/03",
"1997/01/03"), `option type (C,P,T: for calls, puts, and total)` = c("C",
"P", "T", "C", "P", "T", "C", "P", "T", "C", "P", "T"), volume = c(34,
250, 284, 30, 0, 30, 1443, 211, 1654, 4490, 826, 5316)), row.names = c(NA,
-12L), class = c("tbl_df", "tbl", "data.frame"))
> dput(dataset2)
structure(list(ID = c(44652, 44652, 44652, 56266, 56266, 56266
), date = c("1997/01/02", "1997/01/03", "1997/01/04", "1997/01/02",
"1997/01/03", "1997/01/04"), `call volume` = c(NA, NA, NA, NA,
NA, NA), `put volume` = c(NA, NA, NA, NA, NA, NA), `total volume` = c(NA,
NA, NA, NA, NA, NA)), row.names = c(NA, -6L), class = c("tbl_df",
"tbl", "data.frame"))
Update: I have many other columns in both datasets that are quite different from one another, the only common are the ones shown in the picture and dataset below.