Aggregate time to 10 minute

You can adapt one of those solutions according to your data after changing time to POSIXct format.

library(dplyr)
library(lubridate)

df %>%
  mutate(Time = dmy_hm(Time), 
         Time  = ceiling_date(Time, '10 min')) %>%
  group_by(Time) %>%
  summarise(kW_Raw_Data = sum(kW_Raw_Data, na.rm = TRUE)) %>%
  na.omit()

#  Time                kW_Raw_Data
#  <dttm>                    <dbl>
#1 2015-01-06 23:40:00        25.8
#2 2015-01-06 23:50:00        27.1
#3 2015-01-07 00:00:00        23.1
#4 2015-01-07 00:10:00        12.1

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top