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#a7232065 Sent from the R help mailing list archive at Nabble.com.
i think you need braces after your for statements. there might be other issues as well, but that's the first that i noticed tim On 11/8/06, downunder <larsfromspace@web.de> 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#a7232065 > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > R-help@stat.math.ethz.ch 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. >-- Tim Calkins 0406 753 997 [[alternative HTML version deleted]]
I have it work. so far thanks for your help. lars working code z<-matrix(0,d,d) z for (i in 1:d) for (j in 1:d) z[[i,j]]<-chisq.test(x[,i], x[,j])$p.value round(z,3) 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.