aggregate_byname function

Aggregate rows and columns in a matrix