Skip to content
Prev 244815 / 398513 Next

inconsistency with cor() - "x must be numeric"

On Dec 13, 2010, at 23:23 , Justin Fincher wrote:

            
Well, let me put it this way: Once you realize what you are doing, you will appreciate that R is not letting you do that anymore...
This and the similar line 3 lines earlier is the culprit. The c() construct creates a character vector because its 1st argument is character. Hence, acc_averages is a character matrix. Now, are you _sure_ you know what happens if you correlate something with the character vector acc_averages[,2]? It may have given you the right thing for Pearson correlations, but it certainly did not for rank correlations pre 2.11.0, leading to a "non-bug report" and the subsequent check for numeric data. What happened then was that ranks were based on the _alphabetical_ ordering of data!

I'm fairly confident that you'd really want to do the whole thing with a suitable aggregate() call, but for now, how about just keeping the labels and the values in two separate vectors?