Improve robustness of correlation calculations

Introduces additional error handling for correlation and added tests to verify this.

As part of this work, a helper function was introduced to create property accessor functions.

An ErrorContainer was also introduced, in order to allow error and warnings to be passed back to the user.

Finally the average calculations, performed by <code>grouping</code>, were improved to handle taking the average of optional properties.
We should pull out the error messages into a class of constants, such that they are referenced in the test and the implementation.

That way, we just expect(...).toBe(insight.ErrorMessages.expectEqualLengthArrays)