I have an excel file (.xlsx) that contains three columns, with headers:'datetime'(examples: 10/1/2008 0:10, 10/1/2008 0:20 etc), 'RH'(Example: 0.46) and 'wind_mps'(Example: 3.71). I wish to convert the 10 minute interval data into hourly average data for both RH and wind_mps columns.
I was unable to insert the Excel data into this question. Sorry about that. I can edit my question if someone tells me how to.
A similar question has been answered at how to convert by the minute data to hourly average data in R, but I'm new to R and unable to use the same technique for my data. I also tried to use the 'zoo', 'chron' and 'xts' packages to do this, as in http://rpubs.com/hrbrmstr/time-series-machinations but they seem to not work in R 3.02.
I tried to do this in Excel, but couldn't find a reasonably easy technique.
I was able to achieve a similar task of converting hourly data to daily average for another data set using an Excel macro, but I'm unable to do this for 10 minute data. The Macro is given below:
Global year As Integer
Sub Calculate()
Dim start_year As Integer
Dim end_year As Integer
Dim cell_count As Integer
start_year = Cells(19, "M").Value
end_year = Cells(48, "M").Value
year = start_year
cell_count = 19
Do While year < (end_year + 1)
Dim row As Integer
Dim sum As Double
Dim count As Integer
Dim init_row As Integer
init_row = 6
sum = 0
count = 0
Dim cv As Integer
cv = 3
Do Until cv = year
cv = Cells(init_row, "C").Value
init_row = init_row + 1
Loop
row = init_row - 1
Worksheets("Sheet1").Activate
Dim cv1 As Integer
cv1 = Cells(row, "C").Value
Do While cv1 = year
sum = sum + Cells(row, "F").Value
count = count + 1
row = row + 1
cv1 = Cells(row, "C").Value
Loop
Cells(cell_count, "N").Value = sum
Cells(cell_count, "O").Value = count
Cells(cell_count, "P").Value = sum / count
cell_count = cell_count + 1
year = year + 1
Loop
End Sub
It doesn't really matter to me whether I use R, Excel function, Macros or any other technique. It'd be great if someone can tell me how to convert this data set of about 50000 values for RH and wind_mps each to hourly average.
Thanks in advance.