I have this time sequence dataframe (df) that was collected in 5-second intervals. Each time value is repeated for each ID value (only IDs 1001 and 1002 are shown). I want to be able to bin/sum the Data column by each minute interval for each ID.
Time                    ID      Data
2010-01-10 13:45:00     1001    0
2010-01-10 13:45:05     1001    1
2010-01-10 13:45:10     1001    0
2010-01-10 13:45:15     1001    1
....
2010-01-10 13:45:00     1002    0
2010-01-10 13:45:05     1002    0
2010-01-10 13:45:10     1002    0
2010-01-10 13:45:15     1002    1
....
Here's a reproducible example:
library(lubridate)
library(tidyverse)
# generate minimal example
df <- tibble(
  Time = rep(
    seq(
      ymd_hms("2010-01-10 00:00:00"), 
      ymd_hms("2010-01-10 23:59:55"), 
      "5 sec"),
    2
  )
)
df$ID   <- rep(c("1001","1002"), each = nrow(df)/2)
df$Data <- rnorm(nrow(df))
I want my output dataframe to look like
Time               ID         Data
2010-01-10 13:45   1001       2
2010-01-10 13:46   1001       
2010-01-10 13:47   1001  
2010-01-10 13:45   1002       1
2010-01-10 13:46   1002
2010-01-10 13:47   1002  
 
     
    