[R] cor.test() -- how to get the value of a coefficient

Ekaterina Pek ekaterina.pek at gmail.com
Tue Jun 8 22:40:53 CEST 2010

Hi, all.

Yet another beginner to R : )

I wonder, how it's possible to get the value of a coefficient from the
object produced by cor.test() ?

> cor.test(a, b, method="spearman")

	Spearman's rank correlation rho

data:  a and b
S = 21554.28, p-value = 2.496e-11
alternative hypothesis: true rho is not equal to 0
sample estimates:

Warning message:
In cor.test.default(a, b, method = "spearman") :
  Cannot compute exact p-values with ties

So, I'd like to do something like :

> result = cor.test(...)
> rho = result.rho()

-- in order to save then the value in some format into external file.

Thanks in advance for helping !


More information about the R-help mailing list