[R] Reshape into a contingency table/Fisher's test

From: Serguei Kaniovski <kaniovsk_at_wifo.ac.at>
Date: Tue 03 Oct 2006 - 13:03:43 GMT


Dear all,

how can I "reshape"/"cast" the following matrix

00;01;10;11

John.Mike;123;313;12;31
John.Jim;54;57;39;36
John.Steve;135;47;47;74
Mike.Jim;63;37;27;16
Mike.Steve;15;15;5;61

Jim.Steve;6;10;34;35

into a set of stacked 2x2 contingency tables

0;1

John;123;12
Mike;313;31
John;54;39

Jim;57;36
John;135;47
Steve;47;16
...

so that the "fisher.test" and "chisq.test" can be "applied" to the pairs of names. As as result I would like to have the original format, ie

John.Mike
John.Jim
John.Steve
Mike.Jim
Mike.Steve

Jim.Steve

with two columns containing the p-values of the tests.

Thanks a lot,
Serguei

--
___________________________________________________________________

Austrian Institute of Economic Research (WIFO)

Name: Serguei Kaniovski			P.O.Box 91
Tel.: +43-1-7982601-231			Arsenal Objekt 20
Fax:  +43-1-7989386			1103 Vienna, Austria
Mail: Serguei.Kaniovski@wifo.ac.at

http://www.wifo.ac.at/Serguei.Kaniovski

______________________________________________
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.
Received on Tue Oct 03 23:10:57 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Tue 03 Oct 2006 - 14:30:07 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.