My data frame is as follows
df <- tibble::tribble(
~date, ~pcp,
"9/27/2017 9:00", 0,
"9/27/2017 10:00", 0,
"9/27/2017 11:00", 0,
"9/27/2017 12:00", 0,
"9/27/2017 13:00", 0,
"9/27/2017 14:00", 0,
"9/27/2017 15:00", 0,
"9/27/2017 16:00", 0,
"9/27/2017 17:00", 0,
"9/27/2017 18:00", 0,
"9/27/2017 19:00", 0,
"9/27/2017 20:00", 0,
"9/27/2017 21:00", 0,
"9/27/2017 22:00", 0,
"9/27/2017 23:00", 0,
"9/28/2017 0:00", 0,
"9/28/2017 1:00", 0,
"9/28/2017 2:00", 0,
"9/28/2017 3:00", 0,
"9/28/2017 4:00", 0,
"9/28/2017 5:00", 0,
"9/28/2017 6:00", 0,
"9/28/2017 7:00", 0.15,
"9/28/2017 8:00", 8.76,
"9/28/2017 9:00", 0.02,
"9/28/2017 10:00", 0,
"9/28/2017 11:00", 0,
"9/28/2017 12:00", 0,
"9/28/2017 13:00", 0,
"9/28/2017 14:00", 0,
"9/28/2017 15:00", 0,
"9/28/2017 16:00", 0,
"9/28/2017 17:00", 0,
"9/28/2017 18:00", 0,
"9/28/2017 19:00", 0,
"9/28/2017 20:00", 0,
"9/28/2017 21:00", 0,
"9/28/2017 22:00", 0,
"9/28/2017 23:00", 0,
"9/29/2017 0:00", 0,
"9/29/2017 1:00", 0,
"9/29/2017 2:00", 0,
"9/29/2017 3:00", 0,
"9/29/2017 4:00", 0,
"9/29/2017 5:00", 0,
"9/29/2017 6:00", 0,
"9/29/2017 7:00", 0,
"9/29/2017 8:00", 0.31
)
I would like to have a daily aggregate of the data (sum). Instead of aggregating from 00:00 to 23:59 of the same day, I would like it with the initial time starting at 09:00 day i
and ending at 08:59 of day i + 1
(24 h later).
The output is desire is like the following
9/28/2017,8.91
9/29/2017,0.33
I did it manually in Excel, I'm not sure what code to use for this problem. The provided example is an extract of the long data frame. Thanks...