I am attempting to bin time-series data from several years of observation by month using the stat_bin
function in ggplot2
. The code looks like this:
month.breaks<-seq.Date(from=min(afg$DateOccurred),to=max(afg$DateOccurred),by="month") # All months, for breaks
report.region<-ggplot(afg,aes(x=DateOccurred))+stat_bin(aes(y=..density..,fill=Type),breaks=month.breaks)+facet_wrap(~Region)
print(report.region)
When I run print, however, I get the following error:
Error in `+.Date`(left, right) : binary + is not defined for Date objects
If I am reading this correctly, the plus operator is not defined for Date
objects and thus it is not possible to perform this type of binning?