[R] cor.test observations limit

Ming-Chung Li mli at emmes.com
Tue Apr 1 20:57:01 CEST 2003


Hi,

Is there a limit on the number of observations for using cor.test. For
example,

> library(ctest)
> cor.test(rnorm(3000), rnorm(3000), method="spearman")
Error in if (q > (n^3 - n)/6) pspearman(q - 1, n, lower.tail = FALSE) else
pspearman(q,  : 
        missing value where logical needed
In addition: Warning message: 
NAs introduced by coercion 

I mainly want to calculate the spearman correlation rho for a data with
missing values. But the rcorr function in Hmisc library (from
Hmisc_1.4.2.zip) gave me an error message 

> library(Hmisc)
> rcorr(tmp[5600:5900,1:2], type="spearman")
Error in rcorr(tmp[5600:5900, 1:2], type = "spearman") : 
        NA/NaN/Inf in foreign function call (arg 1)

Any help is appreciated,

Ming-Chung Li



More information about the R-help mailing list