I was wondering if anyone could help me with the following:
i have two data sets: (1) one containing an id and an order_date (2) the second containing of that same id and delivery_dates of emails
I want to count the number of emails a person receives before the order_date. However, I cannot manage to do so. When I merge both data files, the order_dates are coupled with the delivery dates, and that is not what I want. Also, I do not want to count all the delivery dates for one person, since it needs to be time dependent.
I hope someone could help me!!
example dataset 1:
id. order_date age xx3 2014/07/04 72 xx3 2014/10/08 72 xx3 2014/11/12 72 xx7 2014/05/02 34 xx7 2014/07/09 34 xx9 2014/12/22 55
example dataset 2:
id. delivery_date xx3 2014/07/02 xx3 2014/08/10 xx3 2014/11/02 xx3 2014/07/02 xx3 2014/12/02 xx3 2014/12/11 xx7 2014/07/05
what i would want:
id. frequency_received order_date xx3 1 2014/07/04 xx3 3 2014/10/08
The dates are in YYYYMMDD format.