[R] chisq test with for loop

downunder larsfromspace at web.de
Wed Nov 8 04:51:34 CET 2006

I have it work. so far thanks for your help. lars

working code

for (i in 1:d)
for (j in 1:d)
z[[i,j]]<-chisq.test(x[,i], x[,j])$p.value

downunder wrote:
> Hi all.
> i am desperating. i need a matrix of p.values from an chi square test.  i
> had it already work but than my computer collapsed when taking the whole
> data set 800x260 into account. i am sure it looked like this but it
> doesn't work now. can anybody help me? thanks in advance.
> x=read.table("C:\...)
> d=ncols(x)
> z<=matrix(0,d,d)
> for(i in 1:d)
> for(j in 1:d)
> z[i,j]<=chisq.test(x[,i],x[,j])$p.value
> round(z,3)

View this message in context: http://www.nabble.com/-R---chisq-test-with-for-loop-tf2593044.html#a7232360
Sent from the R help mailing list archive at Nabble.com.

More information about the R-help mailing list