Add average function

@briannesbitt I have not updated `readme.src.md`. I have no idea in which section this function should be documented.