dostats function

Convenient interface for computing statistics on a vector