I have two large data frames with numerous columns of class character and/or factor. I need to compare the frequency of the values they take in the first and the second data frame by overlying the frequency each pair of variables on the same bar plot. I would like to be able to plot either the count or the proportion.
I am able to plot each one separately.
ds1 <- data.frame(var1 = as.character(c("7","10","11","4", "7","10","11","4")))
ds2 <- data.frame(var2 = c("4","4","7","7", "7","10","11","4"))
ggplot(ds1, aes(var1)) + geom_bar()
ggplot(ds2, aes(var2)) + geom_bar()
But I am struggling to:
- put the two together
- add transparency so both pairs of bars are visible
- plot proportion instead of count