How do I convert a 2x2 contingency table into a long format data frame? I tried this:
library(reshape2)
Table <- matrix(c(7,67,19,71), 2, 2, byrow=TRUE)
rownames(Table) <- c('Drug', 'No_Drug')
colnames(Table) <- c('Comp', 'No_Comp')
melt(Table)
I get this rather than a data frame of 164 rows categorized by Drug vs. No_Drug
Var1 Var2 value
1 Drug Comp 7
2 No_Drug Comp 19
3 Drug No_Comp 67
4 No_Drug No_Comp 71