[R] how to extract object from stats test output (cor.test)?

Abhijit Dasgupta adasgupt at mail.jci.tju.edu
Thu Jun 19 17:36:31 CEST 2008


First of all, you need to store as a list not a vector if you;re storing the entire output. Otherwise, you can just store, for example, cor.test(...)$p.value



On Thu, 19 Jun 2008 11:01:42 -0400
"Patrick Ayscue" <payscue at gmail.com> wrote:

> Hello,
> 
> Is there a way to extract output objects from a stats test without viewing
> the entire output?  I am trying to do so in the following:
> 
> define a vector of length j
> 
> for( i in 1: length (vector)) {
> vector[i] = cor.test (datavector1, datavector2[i], method=("spearman"))
> }
> 
> I would like the reported Spearman's rho to be saved in a vector.  I have
> tried a few different ways of doing this but seem unable to figure out how
> to get only that output without looking at each report and copying by hand.
> 
> 
> Any help would be appreciated.
> 
> 
> Thanks,
> Patrick
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> 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.


-- 
Abhijit Dasgupta



More information about the R-help mailing list