Add 'avg' aggregate function

I'm still not convinced I didn't just miss this somewhere.

Anyway, should be ready to go with docs/tests, unless there's some reason that this wasn't included!