Is it possible to plot two bar facets, based on places "A" and "B", where in each facet I show "year" on the x-axis and the yearly sums on the y-axis?
Here is the toy example I've built:
DF<-data.frame(place=c("A", "A", "A", "B", "B"), amt=c(1, 1, 1, 5, 2), year = c(2000, 2000, 2002, 2001, 2002))
DF$year<-as.factor(DF$year)
I've tried using ddply to get my sums:
sums<-ddply(DF,.(year,place), summarise, sumAmt=sum(amt))
But i don't know how to use that in qplot
qplot(??? , data=sums, facets=.~place)
if i replace ??? = year then i'm simply showing counts. I've read that I should perhaps try using geom_bar(stat = "identity") and aes(x = factor(year), y = sumAmt)), but I don't understand how.