[R] need help with chisq

2009-05-09 Thread JC
I am very new to R. I have some data from a CVS stored in vdata with 4 columns labeled: X08, Y08, X09, Y09. I have created two new "columns" like so: Z08 <- (vdata$X08-vdata$Y08) Z09 <- (vdata$X09-vdata$Y09) I would like to use chisq.test for each "row" and output the p-value for each in a sto

Re: [R] need help with chisq

2009-05-09 Thread David Winsemius
On May 9, 2009, at 4:53 PM, JC wrote: I am very new to R. I have some data from a CVS stored in vdata with 4 columns labeled: X08, Y08, X09, Y09. I have created two new "columns" like so: Z08 <- (vdata$X08-vdata$Y08) Z09 <- (vdata$X09-vdata$Y09) I would like to use chisq.test for each "row

Re: [R] need help with chisq

2009-05-10 Thread Stephanie Kovalchik
JC, If each row are the counts for a 2 x 2 contingency table - so for the ith contingency table you have counts for row 1 c(Y08[i],Z08[i]) and row 2 (Y09[i],Z09[i]) then you could use apply: X <- cbind(vdata$Y08,vdata$X08-vdata$Y08,vdata$Y09,vdata$X09-vdata$Y98) f.chisq <- function(x){ m <

Re: [R] need help with chisq

2009-05-11 Thread JC
Thank you Stephanie. This is perfect! On May 10, 12:34 pm, Stephanie Kovalchik wrote: > JC, > > If each row are the counts for a 2 x 2 contingency table - so for the   > ith contingency table you have counts for row 1 c(Y08[i],Z08[i]) and   > row 2 (Y09[i],Z09[i]) then you could use apply: > > X