I have a huge dataset similar to the following reproducible sample data.
Interval value1 2012-06-10 5522 2012-06-11 48503 2012-06-12 46424 2012-06-13 41325 2012-06-14 41906 2012-06-15 41867 2012-06-16 11398 2012-06-17 4909 2012-06-18 515610 2012-06-19 443011 2012-06-20 444712 2012-06-21 425613 2012-06-22 385614 2012-06-23 116315 2012-06-24 56416 2012-06-25 486617 2012-06-26 442118 2012-06-27 420619 2012-06-28 427220 2012-06-29 399321 2012-06-30 121122 2012-07-01 69823 2012-07-02 577024 2012-07-03 510325 2012-07-04 77526 2012-07-05 514027 2012-07-06 486828 2012-07-07 122529 2012-07-08 67130 2012-07-09 572631 2012-07-10 5176
I want to aggregate this data to weekly level to get the output similar to the following:
Interval value1 Week 2, June 2012 *aggregate value for day 10 to day 14 of June 2012*2 Week 3, June 2012 *aggregate value for day 15 to day 21 of June 2012*3 Week 4, June 2012 *aggregate value for day 22 to day 28 of June 2012*4 Week 5, June 2012 *aggregate value for day 29 to day 30 of June 2012*5 Week 1, July 2012 *aggregate value for day 1 to day 7 of July 2012*6 Week 2, July 2012 *aggregate value for day 8 to day 10 of July 2012*
How do I achieve this easily without writing a long code?