r - cor shows only NA or 1 for correlations - Why? -


I am running a data.frame on cor () With all the numerical values ​​and I am getting it as a result:

  value exp ... value 1 npx nas 1 ...  
< P> If the result is 1 or NA for each value in the table instead of valid correlations, what is showing NA ?

This is 1 s because everything is completely related to yourself , And NA s are the reasons because your variable has NA s.

You have to specify how you want to calculate the value of R, when there is no value, because default is only to calculate a coefficient with complete information.

You use this behavior for core logic, see cor for details.


Comments