I have a problem and would really need your help? My data (let’s name it “date”) looks like this:
location date value
1 2010-01-01 6.4
1 2010-01-02 5.7
.
.
2 2010-01-01 0.8
2 2010-01-02 2.5
2 2010-01-03 5.5
I would like to aggregate data (value) on location and on 3 weeks period? I have already try to use package timeSeries but it is not working?
by1 <- timeSequence(from = "2009-12-30", to = "2010-12-29", by= "4 week")
by1
aggregate(date, by=list(by1, date$location), sum)
Here is an approach using
seq.Dateto generate the break points,cutto bin your data, andddplyto summarize:The results: