I've recently discovered deducer and it's contingency table function (see Exporting deducer's contingency tables as csv or xls)
What I'm trying to do is plot the values from a contingency table in ggplot to show a barplot with % frequency up the y-axis and categorical data along the x-axis. Then if possible I'd like to produce error bars to show the confidence interval for the proportion of each variable from the whole.
For examples using the mtcars
data, R produces this using the contingency.tables
function:
table_gears<-contingency.tables(
row.vars=d(cyl),
col.vars=d(gear),data=mtcars)
print(table_gears,prop.r=T,prop.c=T,prop.t=F)
Basically the proportion of cars with x gears and y cylinders calculated over both row totals and column totals.
Does anyone no of a way of producing this using ddply or similar and adding in the standards error/confidence interval of these proportions too? I am really struggling and would be really grateful for a lifeline!