Dear all, Why aggregation of 15 minute xts data happens on the 45th (3rd quarter) and not the exact hour close (i.e., 00) time?
For example, temp below is an xts sequence with 15-minute frequency: > quarters <- ISOdatetime(2012,05,02,9,0,0) + seq(0:39)*15*60; > set.seed(42); > observation <- xts(1:40, order.by=as.POSIXct(quarters)); > head(observation); [,1] 2012-05-02 09:15:00 1 2012-05-02 09:30:00 2 2012-05-02 09:45:00 3 2012-05-02 10:00:00 4 2012-05-02 10:15:00 5 2012-05-02 10:30:00 6 > ends<-endpoints(observation,'hours'); > temp<-period.apply(observation, ends,sum); > temp [,1] 2012-05-02 09:45:00 6 2012-05-02 10:45:00 22 2012-05-02 11:45:00 38 2012-05-02 12:45:00 54 2012-05-02 13:45:00 70 2012-05-02 14:45:00 86 2012-05-02 15:45:00 102 2012-05-02 16:45:00 118 2012-05-02 17:45:00 134 2012-05-02 18:45:00 150 2012-05-02 19:00:00 40 > I get the sum of every quarter within the hour on the third quarter. How can I implicitly calculate the sum of the quarterly data on the hour's close (10:00, 11:00, 12:00 and so on) ? Many thanks in advance, Costas __________________________________________________________________ *Costas Vorlow <http://www.gravatar.com/avatar/49a9dee59073b1ed4a36440a06aeb81b> * *http://www.linkedin.com/in/costasvorlow <http://www.linkedin.com/in/costasvorlow>* *http://www.vorlow.com* <http://www.vorlow.com> â â â â â â â â â â â â â â â â â â â â â â â â â â â â â â â â â â â [[alternative HTML version deleted]]
______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.