Skip to content
Back to formatted view

Raw Message

Message-ID: <5de9a7fb-c1e2-4afc-a843-3a39cff6c4d2@q2g2000vbr.googlegroups.com>
Date: 2009-05-09T20:53:07Z
From: JC
Subject: need help with chisq

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 stored variable. I don't know how to do it. Can you
help?

so far I have done it for one row (but I want it done automatically
for all my data):

chidata=rbind(c(vdata$Y08[1],Z08[1]),c(vdata$Y09[1],Z09[1]))
results <- chisq.test(chidata)
results$p.value

I tried removing the [1] and the c() but that didn't work...  Any
ideas?

THANKS!