Java Mailing List Archive

http://www.r-help.com/

Home » R Help for Statistical Computing »

[R] chisq.test on samples of different lengths

Marino Taussig De Bodonia, Agnese

2010-08-24

Replies: Find Java Web Hosting

Author LoginPost Reply
Hello,

I am trying to see whether there has been a significant difference in whether people experienced damages from wildlife in two different years. I therefore have two columns:

year 1:
yes
no
no
no
yes
yes
no

year 2:
no
yes
no
yes

I wanted to do a chisq.test, but if I enter it this way:

chisq.test(year1, year2)

I get the error saying the columns are two different lengths. So then I tried doing:

damages<-matrix(c(3,4, 2,2), ncol=2, dimnames=list(answer=c("yes", "no"), year=c("year1", year2)))
chisq.test(damages)

Does that make sense? Should I maybe be doing a different test instead?

Any help would be appreciated, thank you.

Agnese

______________________________________________
R-help@(protected)
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.
©2008 r-help.com - Jax Systems, LLC, U.S.A.