Correlatiion coefficient calculations

Correlations can be calculated on raw data, data sets or groupings.
This function is used to build up the container object with all properties in propertyNames.  The container parameter is updated but neither the dataArray nor propertyNames are updated as far as I can see.  Perhaps this code could be refactored to be a bit clearer?