Aggregating while merging two dataframes in R
问题 The ultimate goal is to sum the total quantity( transact_data$qty ) for each record in product_info where the transact_data$productId exists in product_info , and where transact_data$date is between product_info$beg_date and product_info$end_date . The dataframes are below: product_info <- data.frame(productId = c("A", "B", "A", "C","C","B"), old_price = c(0.5,0.10,0.11,0.12,0.3,0.4), new_price = c(0.7,0.11,0.12,0.11,0.2,0.3), beg_date = c("2014-05-01", "2014-06-01", "2014-05-01", "2014-06-01