[R] Contingency tables profiles

Campo Elías PARDO cepardot at cable.net.co
Fri Feb 18 16:50:37 CET 2005


Thank for your help

I obtained profiles and I found mosaicplot as an interesting alternative.

I don't like my solution about legend in profiles graphics: I inserted empty 
extra columns in order to avoid tue superimposed of legend.

#Data
N <- matrix(0,3,6)
N[1,] <- c(7,7,5,0,4,4)
N[2,] <- c(0,0,0,5,5,5)
N[3,] <- c(4,4,0,0,3,0)
rownames(N) <- c("Ple1","Ple2","Ple3")
colnames(N) <- c("A","B","C","D","E","F")
N
# Row profiles
PF <- N/rowSums(N)
# Columns profiles
PC <- t(N)/rowSums(t(N))
# Graphics
par(mfrow=c(2,2))
barplot(cbind(cbind(t(PF),0),0),legend=colnames(F),density=100,cex.names=0.8)
barplot(cbind(cbind(cbind(t(PC),0),0),0),legend=rownames(F),density=100,cex.names=0.8)
mosaicplot(N,color=TRUE)
library(ade4)
table.cont(t(N),csize=4.5,col.labels=rownames(N))



Campo Elías  PARDO
cepardot at cable.net.co
cepardot at unal.edu.co 


More information about the R-help mailing list