[R] reshaping list into a contingency table

fbarreto fbarreto at ucsd.edu
Thu Feb 24 19:19:57 CET 2011


Hi all,

I have been struggling with this problem for a few days.  

I have a data table like this:

gene	     rpkm1	     diff1	     rpkm2	     diff2
gene1	23		50		13		120
gene2	111		220		827		1200
gene3	75		998		71		910


And I want to re-format it so that, for each gene, I have a 2x2 contingency
table, such as:

gene	      rpkm	       diff
gene1	23		50
gene1	13		120
gene2	111		220
gene2	827		1200
gene3	75		998
gene3	71		910


I have found one post with the same problem
(http://r.789695.n4.nabble.com/R-Reshape-into-a-contingency-table-Fisher-s-test-td809122.html),
but the response was very customized for that format, and I haven't been
able to implement it for my need.

After the table is re-formatted, I know how to do all the splitting and
fisher tests.  All I need is the re-shaping of the table, which will have
~9000 genes in it.

Any insights are greatly appreciated!

fbarreto
-- 
View this message in context: http://r.789695.n4.nabble.com/reshaping-list-into-a-contingency-table-tp3323130p3323130.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list