I have a vector that holds hourly data of 31 days, so it has a length of 31*24 = 744. Now I would like to calculate the mean diurnal cycle of the variable that is included in the vector. In order to do that, the mean value of every hour of the day is needed. For 01 UTC for example, the relevant steps are 1,25,49,73,...,721, for 2 UTC they are 2,26,50,74,...,722 and so forth. So I need something that enables the calculation of the mean value with a 24 element moving window.
Here is some code for an exemplary vector:
set.seed(1)
my.vec <- sample(-20:20, size = 744, replace = T)
The output vector should then be of length 24, of course.
Anybody with a hint?