I got a Data Frame like this:
data <- data.frame(Sex = c("female", "male", "male", "female"),
A1 = c(T,T,F,F),
A2 = c(T,F,F,F),
A3 = c(T,T,T,F))
And I want a single Barplot which shows me the frequency of Trues of A1, A2 and A3 grouped by females and males.
I tried:
# table:
a <- round(prop.table(table(data$Sex, data$A1))*100, 4)
b <- round(prop.table(table(data$Sex, data$A2))*100, 4)
c <- round(prop.table(table(data$Sex, data$A3))*100, 4)
propVars <- cbind(a, b, c)
# remove false:
propVars <- propVars[,c(2,4,6)]
# plot:
barplot(propVars,beside = T)
But now I got the Trues on the x-axis an the sexes as different bars. But i like to have the females on the left side of the x-axis and the males on the right side of the x-axis. And for A1,A2 and A3 I want one bar each, showing the frequency of the trues at every side, one for the females and one for the males. I hope you understand :)
Thanks

ggplot2orlatticeor should it be a base R barplot?cbindstep ("number of rows of matrices must match (see arg 3)")