My question here is to aggregate the data collected at every 1-minute into 5-minute average.
DeviceTime Concentration
6/20/2013 11:13
6/20/201
I'd say the easiest and cleanest way to do this is using the lubridate and dplyr packages.
library(lubridate) # for working with dates
library(dplyr) # for manipulating data
df$DeviceTime5min <- floor_date(df$DeviceTime, "5 mins")
df_5min <- df %>% group_by(DeviceTime5min) %>% summarize(mean(Concentration))
Only problem here is that it works just for values, that fit into an hour ... that is: 1, 2, 3, 4, 5, 6, 10, 12, 15, 20, 30, 60 min. But for these it works perfect :-)