By using the .aggs( ) method, the aggregation method of different variables can be modified. In this example, the aggregation method for the "value" key is changed to "mean" (the default is "sum").
In addition to supporting all of the standard D3 array comparators, this method also accepts custom functions.
Featured on D3plus.org