[R] Retrieve results from chisq.test programmatically

Jingru Dai jingru.dai at sci.monash.edu.au
Tue Jan 15 04:24:30 CET 2008


Hi, Coyne

chisq.test(x)$p.value can retrieve the p-value of the test.
chisq.test(x)$statistic will give you the x-squared result, if you only 
want the number chisq.test(x)$statistic[[1]] can retrieve the numeric 
value.  So you can simply write a loop to do the test and save the 
results in some matrix.

I hope it helps

Jingru Dai

My Coyne wrote:
> Hello,
>
>  
>
> I would like to run a series of chisq.test() and store results (x-square,
> df, p-value) in a matrix for further analysis, but don't know how to do
> such.  Currently I run the command line for each set of data at a time and
> it is time consuming.
>
>  
>
> Thank you for your help.
>
>  
>
> --My Coyne
>
>  
>
>  
>
>  
>
>  
>
>
> 	[[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.
>




More information about the R-help mailing list