I have a (probably) easy problem with histograms in ggplot2 when using facet_wrap
with this sample-table
res<-data.frame(c('a1','a1','a1','a1','a2','a2'),c('b1','b1','b2','b3','b1','b2'),c(1.0,1.5,2.5,4.0,1.0,2.5))
colnames(res)<-c("A","B","C")
I would have expected
ggplot(res,aes(res$C, fill=res$A))+geom_histogram(binwidth=1)+facet_wrap(~B)
to result (amongst other bars) in one bar in the b3
facet at C=4
. However, the only bar at C=4
shows up in the b2
facet. I think by naive idea of facet_wrap doing for ggplots what a group by would do in SQL does not seem to work. Could anyone give me a hint at what I am doing wrong?