I have a data file that is two columns, Date, and Time which I have converted to a date and time in R and a glucose column (example below). The data are provided every 5 minutes and I am trying to get an average over 24 hours and then from 11pm-6am and 6am-11pm.
I cannot figure out how to write code to get this data. I tried the apply.daily
syntax to get the 24 hour average but its giving me an error.
Sample of data:
Datetime Glucose
2018-03-07 23:01:04 154
2018-03-07 23:06:04 235
2018-03-07 23:11:04 232
2018-03-07 23:16:04 144
2018-03-07 23:21:04 134
2018-03-07 23:26:04 107
2018-03-07 23:31:04 108
2018-03-07 23:36:04 122
2018-03-07 23:41:04 143
2018-03-07 23:46:04 113
2018-03-07 23:51:04 115
2018-03-07 23:56:04 116
2018-03-08 00:01:04 117
2018-03-08 00:06:04 117
2018-03-08 00:11:04 114
2018-03-08 00:16:04 109