Решение Base R:
setNames(Reduce(function(x, y) {
merge(x, y, by = "month_year", all.x = TRUE)
},
lapply(list(df1, within(
df2, {
date = dates
rm(dates)
}
)),
function(x) {
x$month_year <- as.Date(strftime(x$date, "%Y-%m-01"), "%Y-%m-%d")
return(x)
}))[, c("date.x", "amount")], c("date", "amount"))
Данные:
df1 <- structure(list(date = as.Date(c("2013-04-26", "2013-05-03",
"2013-05-10", "2013-05-17", "2013-05-24", "2013-05-31", "2013-06-07",
"2013-06-14", "2013-06-21", "2013-06-28", "2013-07-05", "2013-07-12",
"2013-07-19", "2013-07-26", "2013-08-02", "2013-08-09", "2013-08-16",
"2013-08-23", "2013-08-30", "2013-09-06", "2013-09-13", "2013-09-20",
"2013-09-27", "2013-10-04", "2013-10-11", "2013-10-18", "2013-10-25",
"2013-11-01", "2013-11-08", "2013-11-15", "2013-11-22", "2013-11-29",
"2013-12-06", "2013-12-13", "2013-12-20", "2013-12-27", "2014-01-03",
"2014-01-10", "2014-01-17", "2014-01-24", "2014-01-31", "2014-02-07",
"2014-02-14", "2014-02-21", "2014-02-28", "2014-03-07", "2014-03-14",
"2014-03-21", "2014-03-28", "2014-04-04", "2014-04-11", "2014-04-18",
"2014-04-25", "2014-05-02", "2014-05-09", "2014-05-16", "2014-05-23",
"2014-05-30", "2014-06-06", "2014-06-13", "2014-06-20", "2014-06-27",
"2014-07-04", "2014-07-11", "2014-07-18", "2014-07-25", "2014-08-01",
"2014-08-08", "2014-08-15", "2014-08-22", "2014-08-29", "2014-09-05",
"2014-09-12", "2014-09-19", "2014-09-26", "2014-10-03", "2014-10-10",
"2014-10-17", "2014-10-24", "2014-10-31", "2014-11-07", "2014-11-14",
"2014-11-21", "2014-11-28", "2014-12-05", "2014-12-12", "2014-12-19",
"2014-12-26", "2015-01-02", "2015-01-09", "2015-01-16", "2015-01-23",
"2015-01-30", "2015-02-06", "2015-02-13", "2015-02-20", "2015-02-27",
"2015-03-06", "2015-03-13", "2015-03-20", "2015-03-27", "2015-04-03",
"2015-04-10", "2015-04-17", "2015-04-24", "2015-05-01", "2015-05-08",
"2015-05-15", "2015-05-22", "2015-05-29", "2015-06-05", "2015-06-12",
"2015-06-19", "2015-06-26", "2015-07-03", "2015-07-10", "2015-07-17",
"2015-07-24", "2015-07-31", "2015-08-07", "2015-08-14", "2015-08-21",
"2015-08-28", "2015-09-04", "2015-09-11", "2015-09-18", "2015-09-25",
"2015-10-02", "2015-10-09", "2015-10-16", "2015-10-23", "2015-10-30",
"2015-11-06", "2015-11-13", "2015-11-20", "2015-11-27", "2015-12-04",
"2015-12-11", "2015-12-18", "2015-12-25", "2016-01-01", "2016-01-08",
"2016-01-15", "2016-01-22", "2016-01-29", "2016-02-05", "2016-02-12",
"2016-02-19", "2016-02-26", "2016-03-04", "2016-03-11", "2016-03-18",
"2016-03-25", "2016-04-01", "2016-04-08", "2016-04-15", "2016-04-22",
"2016-04-29", "2016-05-06", "2016-05-13", "2016-05-20", "2016-05-27",
"2016-06-03", "2016-06-10", "2016-06-17", "2016-06-24", "2016-07-01",
"2016-07-08", "2016-07-15", "2016-07-22", "2016-07-29", "2016-08-05",
"2016-08-12", "2016-08-19", "2016-08-26", "2016-09-02", "2016-09-09",
"2016-09-16", "2016-09-23", "2016-09-30", "2016-10-07", "2016-10-14",
"2016-10-21", "2016-10-28", "2016-11-04", "2016-11-11", "2016-11-18",
"2016-11-25", "2016-12-02", "2016-12-09", "2016-12-16", "2016-12-23",
"2016-12-30", "2017-01-06", "2017-01-13", "2017-01-20", "2017-01-27",
"2017-02-03", "2017-02-10", "2017-02-17", "2017-02-24", "2017-03-03",
"2017-03-10", "2017-03-17", "2017-03-24", "2017-03-31", "2017-04-07",
"2017-04-14", "2017-04-21", "2017-04-28", "2017-05-05", "2017-05-12",
"2017-05-19", "2017-05-26", "2017-06-02", "2017-06-09", "2017-06-16",
"2017-06-23", "2017-06-30", "2017-07-07", "2017-07-14", "2017-07-21",
"2017-07-28", "2017-08-04", "2017-08-11", "2017-08-18", "2017-08-25",
"2017-09-01", "2017-09-08", "2017-09-15", "2017-09-22", "2017-09-29",
"2017-10-06", "2017-10-13", "2017-10-20", "2017-10-27", "2017-11-03",
"2017-11-10", "2017-11-17", "2017-11-24", "2017-12-01", "2017-12-08",
"2017-12-15", "2017-12-22", "2017-12-29", "2018-01-05", "2018-01-12",
"2018-01-19", "2018-01-26", "2018-02-02", "2018-02-09", "2018-02-16",
"2018-02-23", "2018-03-02", "2018-03-09", "2018-03-16", "2018-03-23",
"2018-03-30", "2018-04-06", "2018-04-13", "2018-04-20", "2018-04-27",
"2018-05-04", "2018-05-11", "2018-05-18", "2018-05-25", "2018-06-01",
"2018-06-08", "2018-06-15", "2018-06-22", "2018-06-29", "2018-07-06",
"2018-07-13", "2018-07-20", "2018-07-27", "2018-08-03", "2018-08-10",
"2018-08-17", "2018-08-24", "2018-08-31", "2018-09-07", "2018-09-14",
"2018-09-21", "2018-09-28", "2018-10-05", "2018-10-12", "2018-10-19",
"2018-10-26", "2018-11-02", "2018-11-09", "2018-11-16", "2018-11-23",
"2018-11-30", "2018-12-07", "2018-12-14", "2018-12-21", "2018-12-28",
"2019-01-04", "2019-01-11", "2019-01-18", "2019-01-25", "2019-02-01",
"2019-02-08", "2019-02-15", "2019-02-22", "2019-03-01", "2019-03-08",
"2019-03-15", "2019-03-22", "2019-03-29", "2019-04-05", "2019-04-12",
"2019-04-19", "2019-04-26", "2019-05-03", "2019-05-10", "2019-05-17",
"2019-05-24", "2019-05-31", "2019-06-07", "2019-06-14", "2019-06-21",
"2019-06-28", "2019-07-05", "2019-07-12", "2019-07-19", "2019-07-26",
"2019-08-02", "2019-08-09", "2019-08-16", "2019-08-23", "2019-08-30",
"2019-09-06", "2019-09-13", "2019-09-20", "2019-09-27", "2019-10-04",
"2019-10-11", "2019-10-18", "2019-10-25", "2019-11-01", "2019-11-08",
"2019-11-15", "2019-11-22", "2019-11-29", "2019-12-06", "2019-12-13",
"2019-12-20", "2019-12-27", "2020-01-03", "2020-01-10", "2020-01-17",
"2020-01-24", "2020-01-31", "2020-02-07", "2020-02-14", "2020-02-21",
"2020-02-28", "2020-03-06", "2020-03-13", "2020-03-20", "2020-03-27"
), "%Y-%m-%d")), class = "data.frame", row.names = c(NA, -362L))
df2 <- structure(list(dates = as.Date(c("2013-06-19", "2013-07-17",
"2013-08-14", "2013-09-18", "2013-10-16", "2013-11-13", "2013-12-18",
"2014-01-15", "2014-02-12", "2014-03-12", "2014-04-15", "2014-05-14",
"2014-06-18", "2014-07-16", "2014-08-13", "2014-09-17", "2014-10-15",
"2014-11-12", "2014-12-17", "2015-01-14", "2015-02-11", "2015-03-11",
"2015-04-15", "2015-05-13", "2015-06-17", "2015-07-15", "2015-08-12",
"2015-09-16", "2015-10-14", "2015-11-10", "2015-12-16", "2016-01-13",
"2016-02-10", "2016-03-16", "2016-04-13", "2016-05-11", "2016-06-15",
"2016-07-13", "2016-08-10", "2016-09-14", "2016-10-12", "2016-11-09",
"2016-12-14", "2017-01-11", "2017-02-15", "2017-03-15", "2017-04-19",
"2017-05-10", "2017-06-14", "2017-07-12", "2017-08-16", "2017-09-13",
"2017-10-11", "2017-11-15", "2017-12-13", "2018-01-17", "2018-02-14",
"2018-03-14", "2018-04-18", "2018-05-16", "2018-06-13", "2018-07-11",
"2018-08-15", "2018-09-19", "2018-10-10", "2018-11-14", "2018-12-12",
"2019-01-16", "2019-02-13", "2019-03-13", "2019-04-17", "2019-05-15",
"2019-06-12", "2019-07-17", "2019-08-14", "2019-09-18", "2019-10-16",
"2019-11-13", "2019-12-11", "2020-01-15", "2020-02-12", "2020-03-11"
), "%Y-%m-%d"), amount = c(0.15, 0.15, 0.15, 0.15, 0.15, 0.15, 0.15, 0.15,
0.15, 0.15, 0.15, 0.15, 0.15, 0.15, 0.15, 0.15, 0.15, 0.15, 0.253,
0.15, 0.15, 0.15, 0.15, 0.15, 0.15, 0.15, 0.15, 0.15, 0.15, 0.15,
0.237, 0.15, 0.15, 0.15, 0.15, 0.15, 0.15, 0.15, 0.15, 0.15,
0.15, 0.15, 0.159, 0.15, 0.15, 0.15, 0.15, 0.15, 0.15, 0.15,
0.15, 0.15, 0.15, 0.15, 0.19, 0.15, 0.15, 0.15, 0.15, 0.15, 0.15,
0.15, 0.15, 0.15, 0.15, 0.15, 0.15, 0.15, 0.15, 0.15, 0.15, 0.15,
0.15, 0.15, 0.15, 0.15, 0.15, 0.15, 0.044, 0.15, 0.15, 0.15)),
class = "data.frame", row.names = c(NA, -82L))