I am trying to export into a new dataframe the number of days within a 16 day time period where temperatures exceed 22.3. I want to complete this for all of the possible 16 day periods within June-August (ie 1st June-16th June, 2nd June-17th June etc etc )
I have daily temperatures for June, July and August (for one year specifically at the moment) with a column for date in this date format: 2090-06-01. I have used the following code and tibbletime : df1<-filter_time(df, time_formula = '2090-06-01' ~ '2090-06-16')
to export a 16 day period and then I can get the sum of days above a certain threshold from that.
** My problem is how to loop this through all 75 of the possible 16 day periods in the time period of June-August. **
Here is a simplified version:
structure(list(Date = structure(c(43981, 43982, 43983, 43984,
43985, 43986, 43987, 43988, 43989, 43990), class = "Date"), Nor_MM = c(22.58582103,
20.43654256, 17.37954095, 18.12772066, 19.53053131, 23.25153522,
24.52291687, 24.83597434, 24.67915157, 24.22688304)), row.names = 6441:6450, class = "data.frame")
Dates are in 2090-06-01
format. How would I go about calculating the sum of days within each possible 4 day period which are above 20 degrees?