Hi Simon,
Hum, you could do that in Python, R or SQL.
Personally, I would use Window Functions in SQL. If you are working on Mac OS X, here is an easy way to install PostgreSQL on your mac.
Hi Simon,
You could do a grouping recipe and then a join recipe.