tracking a cohort over time in R
I have a sample dataset of user ids and months in which a transaction was made. My goal is to calculate, month over month, how many of the original users made transactions. In other words, how many users that were new in January also made transactions in February, March, and April. How many users that were new in February made transactions in March and April, and so on. > data date user_id 1 Jan 2017 1 2 Jan 2017 2 3 Jan 2017 3 4 Jan 2017 4 5 Jan 2017 5 6 Feb 2017 1 7 Feb 2017 3 8 Feb 2017 5 9 Feb 2017 7 10 Feb 2017 9 11 Mar 2017 2 12 Mar 2017 4 13 Mar 2017 6 14 Mar 2017 8 15 Mar 2017 10 16