# Create a data frame with a normally distributed variable at
# a 15 minute sampling rate
ts_seq <- 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_df <- data.frame(DateTime = ts_seq, Var = rnorm(length(ts_seq), 10, 2))
# Aggregate to an hourly sampling rate, taking the maximum of each hour
hourly <- AggDayHour(ts_df, func = max, Freq = "Hour")
# Aggregate with the mean at a daily scale
daily <- AggDayHour(ts_df, func = mean, Freq = "Day")
Run the code above in your browser using DataLab