I'm a beginner stuck in R trying to aggregate daily weather data to weekly. My data looks as follows:
STN YYYYMMDD DDVEC FHVEC FG FHX FHN FXX FXXH TG TN TX T10N Weeknr
235 20161231 227 70 70 80 60 120 10 80 71 87 69 52
235 20161230 227 53 55 60 30 90 6 52 -10 73 -9 52
The idea is to take the average of every day of the week, for every variable except for the first column (indicating locating of measurement), and aggregate it to weekly. I've managed to create a column including the week number, without the year however (as can be seen in the data above).
I've just realised it's different from the alleged duplicate in the following way. The variable STN indicates the weather station, which the results should also be grouped by. So, it should be grouped weekly per station (there's a total of 30 stations with an equal number of observations). I hope someone has the answer!