There are a lot of questions that want the data grouped by 15' by they are only doing it on a single column. Is there a generic function to transform the entire data table? I'm an R newbie and I can't figure it out.
My data set looks like the following
>>DF2[c(1:6), c(1:5)]
Group.1 Station1 Station2 Station3 Station4
2018-09-25 10:01:00 2.37 5.1 2.263 0.737
2018-09-25 10:06:00 2.22 3.8 2.389 0.722
2018-09-25 10:11:00 1.94 6.2 3.389 0.500
2018-09-25 10:15:00 2.79 3.1 2.316 0.211
2018-09-25 10:20:00 2.25 3.5 2.700 0.450
2018-09-25 10:25:00 8.00 9.3 13.050 1.150
The Group.1
column was generated with the following command DF2$Group.1 <- strptime(DF2$Group.1, "%H:%M")
Now, I would like to get the averages for all the stations in 15' increments. But time data in R are giving me a headache. I'm looking for an output like the following:
Group.1 Station1 Station2 Station3 Station4
10:00:00-10:15:00 2.17 5.03 2.68 1.959
10:15:00-10:30:00 4.34 5.3 6.02 1.811
When I was unable to understand the different approaches described in different threads i tried doing it manually with for-loops but that proved an even bigger obstacle. I'm sure because R is R there has to be a one-liner that can do this sort of computation. Any help please?