[R] robust method to obtain a correlation coeff?

Christian Meesters meesters at imbie.uni-bonn.de
Mon Aug 24 16:47:02 CEST 2009


Hi,

Being a R-newbie I am wondering how to calculate a correlation
coefficient (preferably with an associated p-value) for data like:

> d[,1]
 [1] 25.5 25.3 25.1   NA 23.3 21.5 23.8 23.2 24.2 22.7 27.6 24.2 ...
> d[,2]
[1]  0.0 11.1  0.0   NA  0.0 10.1 10.6  9.5  0.0 57.9  0.0  0.0  ...

Apparently corr(d) from the boot-library fails with NAs in the data,
also cor.test cannot cope with a different number of NAs. Is there a
solution to this problem (calculating a correlation coefficient and
ignoring different number of NAs), e.g. Pearson's corr coeff?

If so, please point me to the relevant piece of documentation.

TIA
Christian




More information about the R-help mailing list