[R] Retrieve results from chisq.test programmatically

My Coyne mcoyne at boninc.com
Tue Jan 15 04:35:54 CET 2008


Thanks a bunch.

-----Original Message-----
From: Jingru Dai [mailto:jingru.dai at sci.monash.edu.au] 
Sent: Monday, January 14, 2008 10:25 PM
To: mcoyne at boninc.com; r-help at r-project.org
Subject: Re: [R] Retrieve results from chisq.test programmatically

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