Hi I'd like to aggregate by date and unique values of such that:
Date Client_id Purchase
01-01-2016 00001 Wine
01-01-2016 00001 Beer
01-01-2016 00002 Wine
02-01-2016 00003 Beer
02-01-2016 00004 Wine
03-01-2016 00005 Beer
So I would have something like:
Date Number of Clients
01-01-2016 2
02-01-2016 2
03-01-2016 1
I am trying with dplyr and base R aggregate function but I haven't succeeded:
daily_customers <- df %>% sum(date) %>% unique(Client_id)
daily_customers <- aggregate(Date~ unique(client_id))
Any suggestion?