I have a data set from april to october with registered data every 5 minutes per day. I want to get the average temperature and RH of day and night for every day, considering "day" from 7:30 to 18:30 and "night" for the rest of hours, The table looks like this:
Date Time Temp RH
18/04/2018 00:00:00 21.9 73
18/04/2018 00:05:00 21.9 73
18/04/2018 00:10:00 21.8 73
18/04/2018 00:15:00 21.6 73
18/04/2018 00:20:00 21.6 72
18/04/2018 00:25:00 21.5 72
18/04/2018 00:30:00 21.4 74
And so on till october. I have tried codes from similar questions but for some reason or the other, I always get an error. In one example I saw that there is a column with "AM/PM" values to make this simpler, but then I'd have to create this new column for all the rows. Also tried with "hourly.apply" but it seems that the function doesn't exist.
What I want to obtain is this:
Date Time Temp RH
18/04/2018 day 25.8 80
18/04/2018 night 17.3 43
19/04/2018 day 24.2 73
19/04/2018 night 15.1 42
I typed the code:
> n=287
> T24_GH111 <- aggregate(GH111[,3],list(rep(1:nrow(GH111%%n+1), each=n, leng=nrow(GH111))),mean)[-1];`
But this will give me the average of 24 hours.
Thanks in advance!