# create grouped column test1$grouped_time = lubridate::floor_date(test1$DateTime, unit = "hour") # (use ceiling_date instead if you want to round the half hours up instead of down) # sum by group library(dplyr) test2 = test1 %>% group_by(grouped_time, LCLid, stdorToU, Acorn, Acorn_grouped) %>% summarize(KWH.hh.per.hour = sum(KWH.hh..per.half.hour.))
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter