Here's a simple trick to get data.table aggregation to play nicely with multivariable functions.| Blair’s Science Desk