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

Joris Meys jorismeys at gmail.com
Tue Jun 8 22:49:46 CEST 2010


result <- cor.test(a,b,method="spearman")
result$estimate

Cheers
Joris

On Tue, Jun 8, 2010 at 10:40 PM, Ekaterina Pek <ekaterina.pek at gmail.com> wrote:
> 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:
>      rho
> 0.6807955
>
> 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 !
>
> Regards,
> Kate.
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



-- 
Joris Meys
Statistical consultant

Ghent University
Faculty of Bioscience Engineering
Department of Applied mathematics, biometrics and process control

tel : +32 9 264 59 87
Joris.Meys at Ugent.be
-------------------------------
Disclaimer : http://helpdesk.ugent.be/e-maildisclaimer.php



More information about the R-help mailing list