#Create a data.frame with a normally distributed variable at
#a 15 minute sampling rate.
TS <- seq(as.POSIXct("2000-01-01 00:00:00",
tz = "Europe/London"), as.POSIXct("2001-01-01 00:00:00", tz = "Europe/London"), by = 60*15)
TS <- data.frame(DateTime = TS, Var = rnorm(length(TS), 10, 2))
#use the function to aggregate to an hourly sampling rate, taking the maximum of each hour
Hourly <- AggDayHour(TS, func = max, Freq = "Hour")
#now aggregate with the mean at a daily scale
Daily <- AggDayHour(TS, func = mean, Freq = "Day")
Run the code above in your browser using DataLab