I want to filter the values in df2 in column Change based on the dates between Entry and Exit in df1. For instance between 20030217 and 20030228 there is no reults, therefore the values in Change should be 0.
I tried something like this:
df1
structure(list(Entry = c(20030127L, 20030128L, 20030129L, 20030205L,
20030210L, 20030228L, 20030307L, 20030310L, 20030313L, 20030331L
), Exit = c(20030128L, 20030129L, 20030205L, 20030210L, 20030217L,
20030307L, 20030310L, 20030311L, 20030320L, 20030401L), Result = c(-132,
-204, -455, -1640, 3678, -1516, -610, -247, 4280, -378)), .Names = c("Entry",
"Exit", "Result"), row.names = c(NA, 10L), class = "data.frame")
df2
structure(list(V1 = c(20030127L, 20030128L, 20030129L, 20030130L,
20030131L, 20030203L, 20030204L, 20030205L, 20030206L, 20030207L
), V6 = c(475.65, 469.16, 466.82, 479.68, 477.8, 481.8, 464,
476.34, 474.25, 466.97), Change = c(47565, 46916, 46682, 47968,
47780, 48180, 46400, 47634, 47425, 46697)), .Names = c("V1",
"V6", "Change"), row.names = 52:61, class = "data.frame")