aggregateData function

Aggregates results from the clustering and merging step.