Using `as.Date()` in `mutate()` yields incorrect dates

data <- read.csv(input$file_upload$datapath)
data$Date_Time <- as.POSIXct(data$Date_Time, format = "%Y-%m-%d %H:%M:%S")
valid_data <- data[is.finite(data$CGM_Value), ]
last_date <- max(valid_data$Date_Time, na.rm = TRUE)
start_date <- last_date - 42460*60 # 4 days in seconds
filtered_data <- subset(valid_data, Date_Time >= start_date & Date_Time <= last_date)
result_data <- filtered_data %>%
mutate(Date = as.Date(Date_Time), Hour = as.numeric(format(Date_Time, "%H"))) %>%
group_by(Date, Hour)
This is my code ,but in this code mutate() doenot work on filtered_data instead it work on data frame of data.I want to add Date and Hour to already existing filter_data data frame .

in this code mutate() doe not work on filtered_data instead it work on data frame of data

Your code seems to make a result_data from mutating on filtered_data adding a Date and Hour field

what do you mean 'does not work' ? do you mean it errors ? if so what is the error ?
do you mean it gives incorrect results ? if so how is what you get different from what you intend ?

it does not mean any error instead 'filter_data' containing 'date_time' in rage between 4-8-2018 to 8-8-2018 but after using the function mutate() on this 'filter_data' it return the' result_data' containg date from 3-8-2018 to 7-8-2018 ,that means it doe not work on the ' filtered_data' .

I don't see how what you describe is possible. result_data would have the same rows as filter_data as you only mutate and group it; so no rows are added or removed; furthermore it should have the same date_time as no instruction modifies that.

I tested out your code and it worked as I expect.

You should consider making a minimal reproducible example, if you do indeed have an issue that can be investigated

library(tidyverse)
data <- data.frame(Date_Time='2024-06-27 11:29:33',
                   CGM_Value=1)


data$Date_Time <- as.POSIXct(data$Date_Time, format = "%Y-%m-%d %H:%M:%S")
valid_data <- data[is.finite(data$CGM_Value), ]
last_date <- max(valid_data$Date_Time, na.rm = TRUE)
start_date <- last_date - 42460*60 # 4 days in seconds
filtered_data <- subset(valid_data, Date_Time >= start_date & Date_Time <= last_date)
result_data <- filtered_data %>%
  mutate(Date = as.Date(Date_Time), Hour = as.numeric(format(Date_Time, "%H"))) %>%
  group_by(Date, Hour)
> filtered_data
Date_Time               CGM_Value
1 2024-06-27 11:29:33         1
> result_data 
# A tibble: 1 × 4
# Groups:   Date, Hour [1]
Date_Time               CGM_Value Date        Hour
<dttm>                     <dbl> <date>     <dbl>
  1 2024-06-27 11:29:33         1 2024-06-27    11

Hi @sql ,

Could you run these two lines:

data <- read.csv(input$file_upload$datapath)
dput(data)

and post the output here, between a pair of triple backticks, like this?

```
paste output of dput() here
```

That might help folks here sort out what might be happening.

this work fine for me but in my result_data date 8-8-2018 is taken as 7-8-2018.

Post-Randomization	06-08-2018 22:12	144	  06-08-2018	22
Post-Randomization	06-08-2018 22:17	155	  06-08-2018	22
Post-Randomization	06-08-2018 22:22	166	  06-08-2018	22
Post-Randomization	06-08-2018 22:27	170  06-08-2018	22
Post-Randomization	06-08-2018 22:32	174	06-08-2018	22
Post-Randomization	06-08-2018 22:37	176	06-08-2018	22
Post-Randomization	06-08-2018 22:42	174	06-08-2018	22
Post-Randomization	06-08-2018 22:47	165	06-08-2018	22
Post-Randomization	06-08-2018 22:52	162	06-08-2018	22
Post-Randomization	06-08-2018 22:57	160	06-08-2018	22
Post-Randomization	06-08-2018 23:02	157	06-08-2018	23
Post-Randomization	06-08-2018 23:07	155	06-08-2018	23
Post-Randomization	06-08-2018 23:12	153	06-08-2018	23
Post-Randomization	06-08-2018 23:17	153	06-08-2018	23
Post-Randomization	06-08-2018 23:22	153	06-08-2018	23
Post-Randomization	06-08-2018 23:27	153	06-08-2018	23
Post-Randomization	06-08-2018 23:32	154	06-08-2018	23
Post-Randomization	06-08-2018 23:37	154	06-08-2018	23
Post-Randomization	06-08-2018 23:42	153	06-08-2018	23
Post-Randomization	06-08-2018 23:47	152	06-08-2018	23
Post-Randomization	06-08-2018 23:52	153	06-08-2018	23
Post-Randomization	06-08-2018 23:57	155	06-08-2018	23
Post-Randomization	07-08-2018 00:02	159	06-08-2018	0
Post-Randomization	07-08-2018 00:07	162	06-08-2018	0
Post-Randomization	07-08-2018 00:12	163	06-08-2018	0
Post-Randomization	07-08-2018 00:17	163	06-08-2018	0
Post-Randomization	07-08-2018 00:22	164	06-08-2018	0
Post-Randomization	07-08-2018 00:27	163	06-08-2018	0
Post-Randomization	07-08-2018 00:32	161	06-08-2018	0
Post-Randomization	07-08-2018 00:37	161	06-08-2018	0
Post-Randomization	07-08-2018 00:42	162	06-08-2018	0
Post-Randomization	07-08-2018 00:47	164	06-08-2018	0
Post-Randomization	07-08-2018 00:52	165	06-08-2018	0
Post-Randomization	07-08-2018 00:57	169	06-08-2018	0
Post-Randomization	07-08-2018 01:02	177	06-08-2018	1
Post-Randomization	07-08-2018 01:07	183	06-08-2018	1
Post-Randomization	07-08-2018 01:12	188	06-08-2018	1
Post-Randomization	07-08-2018 01:17	191	06-08-2018	1
Post-Randomization	07-08-2018 01:22	194	06-08-2018	1
Post-Randomization	07-08-2018 01:27	196	06-08-2018	1
Post-Randomization	07-08-2018 01:32	194	06-08-2018	1
Post-Randomization	07-08-2018 01:37	190	06-08-2018	1
Post-Randomization	07-08-2018 01:42	187	06-08-2018	1
Post-Randomization	07-08-2018 01:47	185	06-08-2018	1
Post-Randomization	07-08-2018 01:52	181	06-08-2018	1
Post-Randomization	07-08-2018 01:57	175	06-08-2018	1
Post-Randomization	07-08-2018 02:02	177	06-08-2018	2
Post-Randomization	07-08-2018 02:07	178	06-08-2018	2
Post-Randomization	07-08-2018 02:12	179	06-08-2018	2
Post-Randomization	07-08-2018 02:17	179	06-08-2018	2
Post-Randomization	07-08-2018 02:22	178	06-08-2018	2
Post-Randomization	07-08-2018 02:27	178	06-08-2018	2
Post-Randomization	07-08-2018 02:32	178	06-08-2018	2
Post-Randomization	07-08-2018 02:37	177	06-08-2018	2
Post-Randomization	07-08-2018 02:42	168	06-08-2018	2
Post-Randomization	07-08-2018 02:47	164	06-08-2018	2
Post-Randomization	07-08-2018 02:52	162	06-08-2018	2
Post-Randomization	07-08-2018 02:57	166	06-08-2018	2
Post-Randomization	07-08-2018 03:02	168	06-08-2018	3
Post-Randomization	07-08-2018 03:07	167	06-08-2018	3
Post-Randomization	07-08-2018 03:12	166	06-08-2018	3
Post-Randomization	07-08-2018 03:17	164	06-08-2018	3
Post-Randomization	07-08-2018 03:22	162	06-08-2018	3
Post-Randomization	07-08-2018 03:27	154	06-08-2018	3
Post-Randomization	07-08-2018 03:32	154	06-08-2018	3
Post-Randomization	07-08-2018 03:37	157	06-08-2018	3
Post-Randomization	07-08-2018 03:42	159	06-08-2018	3
Post-Randomization	07-08-2018 03:47	160	06-08-2018	3
Post-Randomization	07-08-2018 03:52	161	06-08-2018	3
Post-Randomization	07-08-2018 03:57	161	06-08-2018	3
Post-Randomization	07-08-2018 04:02	161	06-08-2018	4
Post-Randomization	07-08-2018 04:07	162	06-08-2018	4
Post-Randomization	07-08-2018 04:12	163	06-08-2018	4
Post-Randomization	07-08-2018 04:17	161	06-08-2018	4
Post-Randomization	07-08-2018 04:22	160	06-08-2018	4
Post-Randomization	07-08-2018 04:27	159	06-08-2018	4
Post-Randomization	07-08-2018 04:32	158	06-08-2018	4
Post-Randomization	07-08-2018 04:37	156	06-08-2018	4
Post-Randomization	07-08-2018 04:42	155	06-08-2018	4
Post-Randomization	07-08-2018 04:47	157	06-08-2018	4
Post-Randomization	07-08-2018 04:52	155	06-08-2018	4
Post-Randomization	07-08-2018 04:57	149	06-08-2018	4
Post-Randomization	07-08-2018 05:02	146	06-08-2018	5
Post-Randomization	07-08-2018 05:07	142	06-08-2018	5
Post-Randomization	07-08-2018 05:12	141	06-08-2018	5
Post-Randomization	07-08-2018 05:17	144	06-08-2018	5
Post-Randomization	07-08-2018 05:22	145	06-08-2018	5
Post-Randomization	07-08-2018 05:27	141	06-08-2018	5
Post-Randomization	07-08-2018 05:32	138	07-08-2018	5
Post-Randomization	07-08-2018 05:37	135	07-08-2018	5
Post-Randomization	07-08-2018 05:42	133	07-08-2018	5
Post-Randomization	07-08-2018 05:47	131	07-08-2018	5
Post-Randomization	07-08-2018 05:52	131	07-08-2018	5
Post-Randomization	07-08-2018 05:57	130	07-08-2018	5
Post-Randomization	07-08-2018 06:02	130	07-08-2018	6
Post-Randomization	07-08-2018 06:07	128	07-08-2018	6
Post-Randomization	07-08-2018 06:12	128	07-08-2018	6
Post-Randomization	07-08-2018 06:32	129	07-08-2018	6
Post-Randomization	07-08-2018 06:47	134	07-08-2018	6
Post-Randomization	07-08-2018 06:57	145	07-08-2018	6
Post-Randomization	07-08-2018 07:02	144	07-08-2018	7
Post-Randomization	07-08-2018 07:07	144	07-08-2018	7
Post-Randomization	07-08-2018 07:22	184	07-08-2018	7
Post-Randomization	07-08-2018 07:27	198	07-08-2018	7
Post-Randomization	07-08-2018 07:37	208	07-08-2018	7
Post-Randomization	07-08-2018 07:42	226	07-08-2018	7
Post-Randomization	07-08-2018 07:47	267	07-08-2018	7
Post-Randomization	07-08-2018 07:52	297	07-08-2018	7
Post-Randomization	07-08-2018 07:57	300	07-08-2018	7
Post-Randomization	07-08-2018 08:02	304	07-08-2018	8
Post-Randomization	07-08-2018 08:07	309	07-08-2018	8
Post-Randomization	07-08-2018 08:12	319	07-08-2018	8
Post-Randomization	07-08-2018 08:17	301	07-08-2018	8
Post-Randomization	07-08-2018 08:22	284	07-08-2018	8
Post-Randomization	07-08-2018 17:27	209	07-08-2018	17
Post-Randomization	07-08-2018 21:27	253	07-08-2018	21
Post-Randomization	07-08-2018 21:32	252	07-08-2018	21
Post-Randomization	07-08-2018 21:37	255	07-08-2018	21
Post-Randomization	07-08-2018 21:42	260	07-08-2018	21
Post-Randomization	07-08-2018 21:47	262	07-08-2018	21
Post-Randomization	07-08-2018 21:52	263	07-08-2018	21
Post-Randomization	07-08-2018 21:57	263	07-08-2018	21
Post-Randomization	07-08-2018 22:02	259	07-08-2018	22
Post-Randomization	07-08-2018 22:07	259	07-08-2018	22
Post-Randomization	07-08-2018 22:12	260	07-08-2018	22
Post-Randomization	07-08-2018 22:17	252	07-08-2018	22
Post-Randomization	07-08-2018 22:22	247	07-08-2018	22
Post-Randomization	07-08-2018 22:27	247	07-08-2018	22
Post-Randomization	07-08-2018 22:32	248	07-08-2018	22
Post-Randomization	07-08-2018 22:37	251	07-08-2018	22
Post-Randomization	07-08-2018 22:42	250	07-08-2018	22
Post-Randomization	07-08-2018 22:57	239	07-08-2018	22
Post-Randomization	07-08-2018 23:07	246	07-08-2018	23
Post-Randomization	07-08-2018 23:12	248	07-08-2018	23
Post-Randomization	07-08-2018 23:47	261	07-08-2018	23
Post-Randomization	07-08-2018 23:52	255	07-08-2018	23
Post-Randomization	07-08-2018 23:57	256	07-08-2018	23
Post-Randomization	08-08-2018 00:02	257	07-08-2018	0
Post-Randomization	08-08-2018 00:07	258	07-08-2018	0
Post-Randomization	08-08-2018 00:27	281	07-08-2018	0
Post-Randomization	08-08-2018 00:32	286	07-08-2018	0
Post-Randomization	08-08-2018 00:37	288	07-08-2018	0
Post-Randomization	08-08-2018 00:42	290	07-08-2018	0
Post-Randomization	08-08-2018 00:47	286	07-08-2018	0
Post-Randomization	08-08-2018 00:52	287	07-08-2018	0
Post-Randomization	08-08-2018 00:57	287	07-08-2018	0
Post-Randomization	08-08-2018 01:02	288	07-08-2018	1
Post-Randomization	08-08-2018 01:07	290	07-08-2018	1
Post-Randomization	08-08-2018 01:12	288	07-08-2018	1
Post-Randomization	08-08-2018 01:17	289	07-08-2018	1
Post-Randomization	08-08-2018 01:22	291	07-08-2018	1
Post-Randomization	08-08-2018 01:26	294	07-08-2018	1
Post-Randomization	08-08-2018 01:31	293	07-08-2018	1
Post-Randomization	08-08-2018 01:36	291	07-08-2018	1
Post-Randomization	08-08-2018 01:41	288	07-08-2018	1
Post-Randomization	08-08-2018 01:47	287	07-08-2018	1
Post-Randomization	08-08-2018 02:07	296	07-08-2018	2
Post-Randomization	08-08-2018 02:12	296	07-08-2018	2

this is my 'result_data '

It's the original data that would be helpful — the results don't allow folks to follow the chain of events that leads to the results.

We need the output of dput() not just a listing of the data. The dput() function gives us an exact copy of your R data set.
Here is a very simple example of how to do it.

dat <- data.frame(xx = 1:10, yy = letters[1:10])

dput(dat)

This gives us

structure(list(xx = 1:10, yy = c("a", "b", "c", "d", "e", "f", 
                                 "g", "h", "i", "j")), class = "data.frame", row.names = c(NA,  -10L))

We can then copy it into R

dat <- data.frame(xx = 1:10, yy = letters[1:10])
my_dat  <- structure(list(xx = 1:10, yy = c("a", "b", "c", "d", "e", "f", 
                                            "g", "h", "i", "j")), class = "data.frame", row.names = c(NA,  -10L))

and we have an exact copy of your code and data.

1 Like

sorry ..my file contains around 10 Laks data

If you put row numbers on to your filtered data, you shpuld be able to find a relevant row that is problematic in result. It would only take one row to solve this (probwbly)

Yes, that is a little big to post here. I think @ nirgrahamuk's approach makes sense but to supply some sample data

dput(head(mydata, 500))

probably would give us enough to let us get a feel for the data.

1 Like

I agree, and to get started, even the output of dput(head(data))would help folks get a sense of things, and you could always share a larger table later, @sql .

as far as I can tell, the code works as expected, I've added some code that generates some fake data that shows that the codes does what it should do.

I've also added a line that shows how to generate a sample of your dataset that migt give us some idea of what your data looks like.


library(magrittr)
library(dplyr)

data = data.frame(
  Date_Time = seq(
    as.POSIXct("2018-04-08, 00:00:00", tz = "UTC"), 
    as.POSIXct("2018-08-08, 11:59:59", tz = "UTC"), 
    by = 3600), 
  CGM_Value = sample(c(runif(5, 0, 100), Inf, -Inf), 2929, replace = TRUE)
)

# give me 20 random rows of data
dput(data[sample(nrow(data), 20), ])

# the following seems to work as expected
valid_data <- data[is.finite(data$CGM_Value), ]

last_date <- max(valid_data$Date_Time, na.rm = TRUE)
print(last_date)

start_date <- last_date - 4*24*60*60 # 4 days in seconds
print(start_date)

filtered_data <- subset(valid_data, Date_Time >= start_date & Date_Time <= last_date)
print(range(filtered_data$Date_Time))

result_data <- filtered_data %>%
  mutate(Date = as.Date(Date_Time), Hour = as.numeric(format(Date_Time, "%H"))) %>%
  group_by(Date, Hour)
structure(list(SID = c("DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", 
"DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", 
"DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", 
"DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", 
"DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", 
"DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", 
"DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", 
"DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", 
"DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", 
"DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", 
"DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", 
"DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", 
"DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", 
"DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", 
"DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", 
"DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", 
"DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", 
"DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", 
"DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", 
"DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", 
"DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", 
"DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", 
"DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", 
"DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", 
"DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", 
"DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", 
"DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", 
"DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", 
"DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", 
"DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", 
"DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", 
"DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", 
"DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", 
"DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", 
"DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", 
"DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", 
"DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", 
"DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", 
"DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", 
"DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", 
"DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", 
"DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", 
"DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", 
"DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", 
"DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", 
"DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", 
"DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", 
"DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", 
"DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", 
"DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", 
"DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", 
"DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", 
"DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", 
"DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", 
"DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", 
"DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", 
"DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", 
"DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", 
"DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", 
"DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", 
"DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", 
"DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", 
"DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", 
"DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", 
"DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", 
"DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", 
"DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", 
"DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", 
"DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", 
"DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", 
"DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", 
"DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", 
"DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", 
"DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", 
"DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", 
"DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", 
"DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", 
"DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", 
"DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", 
"DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", 
"DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", 
"DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", 
"DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", 
"DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", 
"DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", 
"DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", 
"DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", 
"DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", 
"DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", 
"DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", 
"DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", 
"DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", 
"DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", 
"DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", 
"DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", 
"DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", 
"DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", 
"DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", 
"DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", 
"DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", 
"DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", 
"DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", 
"DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", 
"DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", 
"DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", 
"DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", 
"DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", 
"DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", 
"DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", 
"DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", 
"DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", 
"DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", 
"DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", 
"DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", 
"DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", 
"DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", 
"DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", 
"DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", 
"DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", 
"DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", 
"DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", 
"DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", 
"DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", 
"DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", 
"DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", "DCLP1-001-001", 
"DCLP1-001-001"), Period = c("Baseline", "Baseline", "Baseline", 
"Baseline", "Baseline", "Baseline", "Baseline", "Baseline", "Baseline", 
"Baseline", "Baseline", "Baseline", "Baseline", "Baseline", "Baseline", 
"Baseline", "Baseline", "Baseline", "Baseline", "Baseline", "Baseline", 
"Baseline", "Baseline", "Baseline", "Baseline", "Baseline", "Baseline", 
"Baseline", "Baseline", "Baseline", "Baseline", "Baseline", "Baseline", 
"Baseline", "Baseline", "Baseline", "Baseline", "Baseline", "Baseline", 
"Baseline", "Baseline", "Baseline", "Baseline", "Baseline", "Baseline", 
"Baseline", "Baseline", "Baseline", "Baseline", "Baseline", "Baseline", 
"Baseline", "Baseline", "Baseline", "Baseline", "Baseline", "Baseline", 
"Baseline", "Baseline", "Baseline", "Baseline", "Baseline", "Baseline", 
"Baseline", "Baseline", "Baseline", "Baseline", "Baseline", "Baseline", 
"Baseline", "Baseline", "Baseline", "Baseline", "Baseline", "Baseline", 
"Baseline", "Baseline", "Baseline", "Baseline", "Baseline", "Baseline", 
"Baseline", "Baseline", "Baseline", "Baseline", "Baseline", "Baseline", 
"Baseline", "Baseline", "Baseline", "Baseline", "Baseline", "Baseline", 
"Baseline", "Baseline", "Baseline", "Baseline", "Baseline", "Baseline", 
"Baseline", "Baseline", "Baseline", "Baseline", "Baseline", "Baseline", 
"Baseline", "Baseline", "Baseline", "Baseline", "Baseline", "Baseline", 
"Baseline", "Baseline", "Baseline", "Baseline", "Baseline", "Baseline", 
"Baseline", "Baseline", "Baseline", "Baseline", "Baseline", "Baseline", 
"Baseline", "Baseline", "Baseline", "Baseline", "Baseline", "Baseline", 
"Baseline", "Baseline", "Baseline", "Baseline", "Baseline", "Baseline", 
"Baseline", "Baseline", "Baseline", "Baseline", "Baseline", "Baseline", 
"Baseline", "Baseline", "Baseline", "Baseline", "Baseline", "Baseline", 
"Baseline", "Baseline", "Baseline", "Baseline", "Baseline", "Baseline", 
"Baseline", "Baseline", "Baseline", "Baseline", "Baseline", "Baseline", 
"Baseline", "Baseline", "Baseline", "Baseline", "Baseline", "Baseline", 
"Baseline", "Baseline", "Baseline", "Baseline", "Baseline", "Baseline", 
"Baseline", "Baseline", "Baseline", "Baseline", "Baseline", "Baseline", 
"Baseline", "Baseline", "Baseline", "Baseline", "Baseline", "Baseline", 
"Baseline", "Baseline", "Baseline", "Baseline", "Baseline", "Baseline", 
"Baseline", "Baseline", "Baseline", "Baseline", "Baseline", "Baseline", 
"Baseline", "Baseline", "Baseline", "Baseline", "Baseline", "Baseline", 
"Baseline", "Baseline", "Baseline", "Baseline", "Baseline", "Baseline", 
"Baseline", "Baseline", "Baseline", "Baseline", "Baseline", "Baseline", 
"Baseline", "Baseline", "Baseline", "Baseline", "Baseline", "Baseline", 
"Baseline", "Baseline", "Baseline", "Baseline", "Baseline", "Baseline", 
"Baseline", "Baseline", "Baseline", "Baseline", "Baseline", "Baseline", 
"Baseline", "Baseline", "Baseline", "Baseline", "Baseline", "Baseline", 
"Baseline", "Baseline", "Baseline", "Baseline", "Baseline", "Baseline", 
"Baseline", "Baseline", "Baseline", "Baseline", "Baseline", "Baseline", 
"Baseline", "Baseline", "Baseline", "Baseline", "Baseline", "Baseline", 
"Baseline", "Baseline", "Baseline", "Baseline", "Baseline", "Baseline", 
"Baseline", "Baseline", "Baseline", "Baseline", "Baseline", "Baseline", 
"Baseline", "Baseline", "Baseline", "Baseline", "Baseline", "Baseline", 
"Baseline", "Baseline", "Baseline", "Baseline", "Baseline", "Baseline", 
"Baseline", "Baseline", "Baseline", "Baseline", "Baseline", "Baseline", 
"Baseline", "Baseline", "Baseline", "Baseline", "Baseline", "Baseline", 
"Baseline", "Baseline", "Baseline", "Baseline", "Baseline", "Baseline", 
"Baseline", "Baseline", "Baseline", "Baseline", "Baseline", "Baseline", 
"Baseline", "Baseline", "Baseline", "Baseline", "Baseline", "Baseline", 
"Baseline", "Baseline", "Baseline", "Baseline", "Baseline", "Baseline", 
"Baseline", "Baseline", "Baseline", "Baseline", "Baseline", "Baseline", 
"Baseline", "Baseline", "Baseline", "Baseline", "Baseline", "Baseline", 
"Baseline", "Baseline", "Baseline", "Baseline", "Baseline", "Baseline", 
"Baseline", "Baseline", "Baseline", "Baseline", "Baseline", "Baseline", 
"Baseline", "Baseline", "Baseline", "Baseline", "Baseline", "Baseline", 
"Baseline", "Baseline", "Baseline", "Baseline", "Baseline", "Baseline", 
"Baseline", "Baseline", "Baseline", "Baseline", "Baseline", "Baseline", 
"Baseline", "Baseline", "Baseline", "Baseline", "Baseline", "Baseline", 
"Baseline", "Baseline", "Baseline", "Baseline", "Baseline", "Baseline", 
"Baseline", "Baseline", "Baseline", "Baseline", "Baseline", "Baseline", 
"Baseline", "Baseline", "Baseline", "Baseline", "Baseline", "Baseline", 
"Baseline", "Baseline", "Baseline", "Baseline", "Baseline", "Baseline", 
"Baseline", "Baseline", "Baseline", "Baseline", "Baseline", "Baseline", 
"Baseline", "Baseline", "Baseline", "Baseline", "Baseline", "Baseline", 
"Baseline", "Baseline", "Baseline", "Baseline", "Baseline", "Baseline", 
"Baseline", "Baseline", "Baseline", "Baseline", "Baseline", "Baseline", 
"Baseline", "Baseline", "Baseline", "Baseline", "Baseline", "Baseline", 
"Baseline", "Baseline", "Baseline", "Baseline", "Baseline", "Baseline", 
"Baseline", "Baseline", "Baseline", "Baseline", "Baseline", "Baseline", 
"Baseline", "Baseline", "Baseline", "Baseline", "Baseline", "Baseline", 
"Baseline", "Baseline", "Baseline", "Baseline", "Baseline", "Baseline", 
"Baseline", "Baseline", "Baseline", "Baseline", "Baseline", "Baseline", 
"Baseline", "Baseline", "Baseline", "Baseline", "Baseline", "Baseline", 
"Baseline", "Baseline", "Baseline", "Baseline", "Baseline", "Baseline", 
"Baseline", "Baseline", "Baseline", "Baseline", "Baseline", "Baseline", 
"Baseline", "Baseline", "Baseline", "Baseline", "Baseline", "Baseline", 
"Baseline", "Baseline", "Baseline", "Baseline", "Baseline", "Baseline", 
"Baseline", "Baseline", "Baseline", "Baseline", "Baseline", "Baseline", 
"Baseline", "Baseline", "Baseline", "Baseline", "Baseline", "Baseline", 
"Baseline", "Baseline", "Baseline", "Baseline", "Baseline", "Baseline", 
"Baseline", "Baseline", "Baseline", "Baseline", "Baseline"), 
    Date_Time = c("2017-11-02 23:58:00", "2017-11-03 00:03:00", 
    "2017-11-03 00:08:00", "2017-11-03 00:13:00", "2017-11-03 00:18:00", 
    "2017-11-03 00:23:00", "2017-11-03 00:28:00", "2017-11-03 00:33:00", 
    "2017-11-03 00:38:00", "2017-11-03 00:43:00", "2017-11-03 00:48:00", 
    "2017-11-03 00:53:00", "2017-11-03 00:58:00", "2017-11-03 01:03:00", 
    "2017-11-03 01:08:00", "2017-11-03 01:13:00", "2017-11-03 01:18:00", 
    "2017-11-03 01:23:00", "2017-11-03 01:28:00", "2017-11-03 01:33:00", 
    "2017-11-03 01:38:00", "2017-11-03 01:43:00", "2017-11-03 01:48:00", 
    "2017-11-03 01:53:00", "2017-11-03 01:58:00", "2017-11-03 02:03:00", 
    "2017-11-03 02:08:00", "2017-11-03 02:13:00", "2017-11-03 02:18:00", 
    "2017-11-03 02:23:00", "2017-11-03 02:28:00", "2017-11-03 02:33:00", 
    "2017-11-03 02:38:00", "2017-11-03 02:43:00", "2017-11-03 02:48:00", 
    "2017-11-03 02:53:00", "2017-11-03 02:58:00", "2017-11-03 03:03:00", 
    "2017-11-03 03:08:00", "2017-11-03 03:13:00", "2017-11-03 03:18:00", 
    "2017-11-03 03:23:00", "2017-11-03 03:28:00", "2017-11-03 03:33:00", 
    "2017-11-03 03:38:00", "2017-11-03 03:43:00", "2017-11-03 03:48:00", 
    "2017-11-03 03:53:00", "2017-11-03 03:58:00", "2017-11-03 04:03:00", 
    "2017-11-03 04:08:00", "2017-11-03 04:13:00", "2017-11-03 04:18:00", 
    "2017-11-03 04:23:00", "2017-11-03 04:28:00", "2017-11-03 04:33:00", 
    "2017-11-03 04:38:00", "2017-11-03 04:43:00", "2017-11-03 04:48:00", 
    "2017-11-03 04:53:00", "2017-11-03 04:58:00", "2017-11-03 05:03:00", 
    "2017-11-03 05:08:00", "2017-11-03 05:13:00", "2017-11-03 05:18:00", 
    "2017-11-03 05:23:00", "2017-11-03 05:28:00", "2017-11-03 05:33:00", 
    "2017-11-03 05:38:00", "2017-11-03 05:43:00", "2017-11-03 05:48:00", 
    "2017-11-03 05:53:00", "2017-11-03 05:58:00", "2017-11-03 06:03:00", 
    "2017-11-03 06:08:00", "2017-11-03 06:13:00", "2017-11-03 06:18:00", 
    "2017-11-03 06:23:00", "2017-11-03 06:28:00", "2017-11-03 06:33:00", 
    "2017-11-03 06:38:00", "2017-11-03 06:43:00", "2017-11-03 06:48:00", 
    "2017-11-03 06:58:00", "2017-11-03 07:03:00", "2017-11-03 07:08:00", 
    "2017-11-03 07:13:00", "2017-11-03 07:18:00", "2017-11-03 07:23:00", 
    "2017-11-03 07:28:00", "2017-11-03 07:33:00", "2017-11-03 07:38:00", 
    "2017-11-03 07:43:00", "2017-11-03 07:48:00", "2017-11-03 07:53:00", 
    "2017-11-03 07:58:00", "2017-11-03 08:03:00", "2017-11-03 08:08:00", 
    "2017-11-03 08:13:00", "2017-11-03 08:18:00", "2017-11-03 08:23:00", 
    "2017-11-03 08:28:00", "2017-11-03 08:33:00", "2017-11-03 08:38:00", 
    "2017-11-03 08:43:00", "2017-11-03 08:48:00", "2017-11-03 08:53:00", 
    "2017-11-03 08:58:00", "2017-11-03 09:03:00", "2017-11-03 09:08:00", 
    "2017-11-03 09:13:00", "2017-11-03 09:18:00", "2017-11-03 09:23:00", 
    "2017-11-03 09:28:00", "2017-11-03 09:33:00", "2017-11-03 09:38:00", 
    "2017-11-03 09:43:00", "2017-11-03 09:48:00", "2017-11-03 09:53:00", 
    "2017-11-03 09:58:00", "2017-11-03 10:03:00", "2017-11-03 10:08:00", 
    "2017-11-03 10:13:00", "2017-11-03 10:18:00", "2017-11-03 10:23:00", 
    "2017-11-03 10:28:00", "2017-11-03 10:33:00", "2017-11-03 10:38:00", 
    "2017-11-03 10:43:00", "2017-11-03 10:48:00", "2017-11-03 10:53:00", 
    "2017-11-03 10:58:00", "2017-11-03 11:03:00", "2017-11-03 11:08:00", 
    "2017-11-03 11:13:00", "2017-11-03 11:18:00", "2017-11-03 11:23:00", 
    "2017-11-03 11:28:00", "2017-11-03 11:33:00", "2017-11-03 11:38:00", 
    "2017-11-03 11:43:00", "2017-11-03 11:48:00", "2017-11-03 11:53:00", 
    "2017-11-03 11:58:00", "2017-11-03 12:03:00", "2017-11-03 12:08:00", 
    "2017-11-03 12:13:00", "2017-11-03 12:18:00", "2017-11-03 12:23:00", 
    "2017-11-03 12:28:00", "2017-11-03 12:33:00", "2017-11-03 12:38:00", 
    "2017-11-03 12:43:00", "2017-11-03 16:13:00", "2017-11-03 16:18:00", 
    "2017-11-03 16:23:00", "2017-11-03 16:28:00", "2017-11-03 16:33:00", 
    "2017-11-03 16:38:00", "2017-11-03 16:43:00", "2017-11-03 16:48:00", 
    "2017-11-03 16:53:00", "2017-11-03 16:58:00", "2017-11-03 17:03:00", 
    "2017-11-03 17:08:00", "2017-11-03 17:13:00", "2017-11-03 17:18:00", 
    "2017-11-03 17:23:00", "2017-11-03 17:28:00", "2017-11-03 17:33:00", 
    "2017-11-03 17:38:00", "2017-11-03 17:43:00", "2017-11-03 17:48:00", 
    "2017-11-03 17:53:00", "2017-11-03 17:58:00", "2017-11-03 18:03:00", 
    "2017-11-03 18:08:00", "2017-11-03 18:13:00", "2017-11-03 18:18:00", 
    "2017-11-03 18:23:00", "2017-11-03 18:28:00", "2017-11-03 18:33:00", 
    "2017-11-03 18:38:00", "2017-11-03 18:43:00", "2017-11-03 18:48:00", 
    "2017-11-03 18:53:00", "2017-11-03 18:58:00", "2017-11-03 19:03:00", 
    "2017-11-03 19:08:00", "2017-11-03 19:13:00", "2017-11-03 19:18:00", 
    "2017-11-03 19:23:00", "2017-11-03 19:28:00", "2017-11-03 19:33:00", 
    "2017-11-03 19:38:00", "2017-11-03 19:43:00", "2017-11-03 19:48:00", 
    "2017-11-03 19:53:00", "2017-11-03 19:58:00", "2017-11-03 20:03:00", 
    "2017-11-03 20:08:00", "2017-11-03 20:13:00", "2017-11-03 20:18:00", 
    "2017-11-03 20:23:00", "2017-11-03 20:28:00", "2017-11-03 20:33:00", 
    "2017-11-03 20:38:00", "2017-11-03 20:43:00", "2017-11-03 20:48:00", 
    "2017-11-03 20:53:00", "2017-11-03 20:58:00", "2017-11-03 21:03:00", 
    "2017-11-03 21:08:00", "2017-11-03 21:13:00", "2017-11-03 21:18:00", 
    "2017-11-03 21:23:00", "2017-11-03 21:28:00", "2017-11-03 21:33:00", 
    "2017-11-03 21:38:00", "2017-11-03 21:43:00", "2017-11-03 21:48:00", 
    "2017-11-03 21:53:00", "2017-11-03 21:58:00", "2017-11-03 22:03:00", 
    "2017-11-03 22:08:00", "2017-11-03 22:13:00", "2017-11-03 22:18:00", 
    "2017-11-03 22:23:00", "2017-11-03 22:28:00", "2017-11-03 22:33:00", 
    "2017-11-03 22:38:00", "2017-11-03 22:43:00", "2017-11-03 22:48:00", 
    "2017-11-03 22:53:00", "2017-11-03 22:58:00", "2017-11-03 23:03:00", 
    "2017-11-03 23:08:00", "2017-11-03 23:13:00", "2017-11-03 23:18:00", 
    "2017-11-03 23:23:00", "2017-11-03 23:28:00", "2017-11-03 23:33:00", 
    "2017-11-03 23:38:00", "2017-11-03 23:43:00", "2017-11-03 23:48:00", 
    "2017-11-03 23:53:00", "2017-11-03 23:58:00", "2017-11-04 00:03:00", 
    "2017-11-04 00:08:00", "2017-11-04 00:13:00", "2017-11-04 00:18:00", 
    "2017-11-04 00:23:00", "2017-11-04 00:28:00", "2017-11-04 00:33:00", 
    "2017-11-04 00:38:00", "2017-11-04 00:43:00", "2017-11-04 00:48:00", 
    "2017-11-04 00:53:00", "2017-11-04 00:58:00", "2017-11-04 01:03:00", 
    "2017-11-04 01:08:00", "2017-11-04 01:13:00", "2017-11-04 01:18:00", 
    "2017-11-04 01:23:00", "2017-11-04 01:28:00", "2017-11-04 01:33:00", 
    "2017-11-04 01:38:00", "2017-11-04 01:43:00", "2017-11-04 01:48:00", 
    "2017-11-04 01:53:00", "2017-11-04 01:58:00", "2017-11-04 02:03:00", 
    "2017-11-04 02:08:00", "2017-11-04 02:13:00", "2017-11-04 02:18:00", 
    "2017-11-04 02:23:00", "2017-11-04 02:28:00", "2017-11-04 02:33:00", 
    "2017-11-04 02:38:00", "2017-11-04 02:43:00", "2017-11-04 02:48:00", 
    "2017-11-04 02:53:00", "2017-11-04 02:58:00", "2017-11-04 03:03:00", 
    "2017-11-04 03:08:00", "2017-11-04 03:13:00", "2017-11-04 03:18:00", 
    "2017-11-04 03:23:00", "2017-11-04 03:28:00", "2017-11-04 03:33:00", 
    "2017-11-04 03:38:00", "2017-11-04 03:43:00", "2017-11-04 03:48:00", 
    "2017-11-04 03:53:00", "2017-11-04 03:58:00", "2017-11-04 04:03:00", 
    "2017-11-04 04:08:00", "2017-11-04 04:13:00", "2017-11-04 04:18:00", 
    "2017-11-04 04:23:00", "2017-11-04 04:28:00", "2017-11-04 04:33:00", 
    "2017-11-04 04:38:00", "2017-11-04 04:43:00", "2017-11-04 04:48:00", 
    "2017-11-04 04:53:00", "2017-11-04 04:58:00", "2017-11-04 05:03:00", 
    "2017-11-04 05:08:00", "2017-11-04 05:13:00", "2017-11-04 05:18:00", 
    "2017-11-04 05:23:00", "2017-11-04 05:28:00", "2017-11-04 05:33:00", 
    "2017-11-04 05:38:00", "2017-11-04 05:43:00", "2017-11-04 05:48:00", 
    "2017-11-04 05:53:00", "2017-11-04 05:58:00", "2017-11-04 06:03:00", 
    "2017-11-04 06:08:00", "2017-11-04 06:13:00", "2017-11-04 06:18:00", 
    "2017-11-04 06:23:00", "2017-11-04 06:28:00", "2017-11-04 06:33:00", 
    "2017-11-04 06:38:00", "2017-11-04 06:48:00", "2017-11-04 06:53:00", 
    "2017-11-04 06:58:00", "2017-11-04 07:03:00", "2017-11-04 07:08:00", 
    "2017-11-04 07:13:00", "2017-11-04 07:18:00", "2017-11-04 07:23:00", 
    "2017-11-04 07:28:00", "2017-11-04 07:33:00", "2017-11-04 07:38:00", 
    "2017-11-04 07:43:00", "2017-11-04 07:48:00", "2017-11-04 07:53:00", 
    "2017-11-04 07:58:00", "2017-11-04 08:03:00", "2017-11-04 08:08:00", 
    "2017-11-04 08:13:00", "2017-11-04 08:18:00", "2017-11-04 08:23:00", 
    "2017-11-04 08:28:00", "2017-11-04 08:33:00", "2017-11-04 08:38:00", 
    "2017-11-04 08:43:00", "2017-11-04 08:48:00", "2017-11-04 08:53:00", 
    "2017-11-04 08:58:00", "2017-11-04 09:03:00", "2017-11-04 09:08:00", 
    "2017-11-04 09:13:00", "2017-11-04 09:18:00", "2017-11-04 09:23:00", 
    "2017-11-04 09:28:00", "2017-11-04 09:33:00", "2017-11-04 09:38:00", 
    "2017-11-04 09:43:00", "2017-11-04 09:48:00", "2017-11-04 09:53:00", 
    "2017-11-04 09:58:00", "2017-11-04 10:03:00", "2017-11-04 10:08:00", 
    "2017-11-04 10:13:00", "2017-11-04 10:18:00", "2017-11-04 10:23:00", 
    "2017-11-04 10:28:00", "2017-11-04 10:33:00", "2017-11-04 10:38:00", 
    "2017-11-04 10:43:00", "2017-11-04 10:48:00", "2017-11-04 10:53:00", 
    "2017-11-04 10:58:00", "2017-11-04 11:03:00", "2017-11-04 11:08:00", 
    "2017-11-04 11:13:00", "2017-11-04 11:18:00", "2017-11-04 11:23:00", 
    "2017-11-04 11:28:00", "2017-11-04 11:33:00", "2017-11-04 11:38:00", 
    "2017-11-04 11:43:00", "2017-11-04 11:48:00", "2017-11-04 11:53:00", 
    "2017-11-04 11:58:00", "2017-11-04 12:03:00", "2017-11-04 12:08:00", 
    "2017-11-04 12:13:00", "2017-11-04 12:18:00", "2017-11-04 12:23:00", 
    "2017-11-04 12:28:00", "2017-11-04 12:33:00", "2017-11-04 12:38:00", 
    "2017-11-04 12:43:00", "2017-11-04 12:48:00", "2017-11-04 12:53:00", 
    "2017-11-04 12:58:00", "2017-11-04 13:03:00", "2017-11-04 13:08:00", 
    "2017-11-04 13:13:00", "2017-11-04 13:18:00", "2017-11-04 13:23:00", 
    "2017-11-04 13:28:00", "2017-11-04 13:33:00", "2017-11-04 13:38:00", 
    "2017-11-04 13:43:00", "2017-11-04 13:48:00", "2017-11-04 13:53:00", 
    "2017-11-04 13:58:00", "2017-11-04 14:03:00", "2017-11-04 14:08:00", 
    "2017-11-04 14:13:00", "2017-11-04 14:18:00", "2017-11-04 14:23:00", 
    "2017-11-04 14:28:00", "2017-11-04 14:33:00", "2017-11-04 14:38:00", 
    "2017-11-04 14:43:00", "2017-11-04 14:48:00", "2017-11-04 14:53:00", 
    "2017-11-04 14:58:00", "2017-11-04 15:03:00", "2017-11-04 15:08:00", 
    "2017-11-04 15:13:00", "2017-11-04 15:18:00", "2017-11-04 15:23:00", 
    "2017-11-04 15:28:00", "2017-11-04 15:33:00", "2017-11-04 15:38:00", 
    "2017-11-04 15:43:00", "2017-11-04 15:48:00", "2017-11-04 15:53:00", 
    "2017-11-04 15:58:00", "2017-11-04 16:03:00", "2017-11-04 16:08:00", 
    "2017-11-04 16:13:00", "2017-11-04 16:18:00", "2017-11-04 16:23:00", 
    "2017-11-04 16:28:00", "2017-11-04 16:33:00", "2017-11-04 16:38:00", 
    "2017-11-04 16:43:00", "2017-11-04 16:48:00", "2017-11-04 16:53:00", 
    "2017-11-04 16:58:00", "2017-11-04 17:03:00", "2017-11-04 17:08:00", 
    "2017-11-04 17:13:00", "2017-11-04 17:18:00", "2017-11-04 17:23:00", 
    "2017-11-04 17:28:00", "2017-11-04 17:33:00", "2017-11-04 17:38:00", 
    "2017-11-04 17:43:00", "2017-11-04 17:48:00", "2017-11-04 17:53:00", 
    "2017-11-04 17:58:00", "2017-11-04 18:03:00", "2017-11-04 18:08:00", 
    "2017-11-04 18:13:00", "2017-11-04 18:18:00", "2017-11-04 18:23:00", 
    "2017-11-04 18:28:00", "2017-11-04 18:33:00", "2017-11-04 18:38:00", 
    "2017-11-04 18:43:00", "2017-11-04 18:48:00", "2017-11-04 18:53:00", 
    "2017-11-04 18:58:00", "2017-11-04 19:03:00", "2017-11-04 19:08:00", 
    "2017-11-04 19:13:00", "2017-11-04 19:18:00", "2017-11-04 19:23:00", 
    "2017-11-04 19:28:00", "2017-11-04 19:33:00", "2017-11-04 19:38:00", 
    "2017-11-04 19:43:00", "2017-11-04 19:48:00", "2017-11-04 19:53:00", 
    "2017-11-04 19:58:00", "2017-11-04 20:03:00", "2017-11-04 20:08:00", 
    "2017-11-04 20:13:00", "2017-11-04 20:18:00", "2017-11-04 20:23:00", 
    "2017-11-04 20:28:00", "2017-11-04 20:33:00", "2017-11-04 20:38:00", 
    "2017-11-04 20:43:00", "2017-11-04 20:48:00", "2017-11-04 20:53:00", 
    "2017-11-04 20:58:00", "2017-11-04 21:08:00", "2017-11-04 21:13:00"
    ), CGM_Value = c(108L, 118L, 124L, 125L, 123L, 121L, 120L, 
    119L, 120L, 122L, 127L, 132L, 139L, 145L, 152L, 157L, 162L, 
    165L, 169L, 173L, 177L, 182L, 187L, 190L, 191L, 192L, 193L, 
    198L, 204L, 207L, 202L, 203L, 208L, 210L, 214L, 215L, 217L, 
    218L, 219L, 218L, 220L, 220L, 218L, 218L, 216L, 215L, 213L, 
    211L, 210L, 208L, 206L, 204L, 202L, 199L, 195L, 192L, 188L, 
    185L, 180L, 175L, 172L, 170L, 168L, 166L, 164L, 162L, 161L, 
    162L, 163L, 163L, 163L, 160L, 159L, 159L, 153L, 155L, 159L, 
    160L, 163L, 160L, 156L, 155L, 155L, 162L, 161L, 160L, 160L, 
    158L, 170L, 166L, 179L, 192L, 198L, 192L, 180L, 167L, 156L, 
    147L, 141L, 138L, 139L, 141L, 143L, 144L, 147L, 146L, 144L, 
    143L, 142L, 139L, 134L, 130L, 126L, 122L, 119L, 117L, 118L, 
    122L, 130L, 138L, 140L, 142L, 144L, 145L, 147L, 145L, 144L, 
    143L, 140L, 137L, 137L, 134L, 134L, 130L, 128L, 126L, 123L, 
    120L, 118L, 116L, 113L, 109L, 108L, 105L, 102L, 98L, 95L, 
    93L, 90L, 88L, 87L, 86L, 83L, 103L, 100L, 104L, 102L, 101L, 
    99L, 98L, 99L, 100L, 104L, 104L, 104L, 103L, 102L, 102L, 
    103L, 104L, 105L, 106L, 107L, 106L, 106L, 103L, 98L, 94L, 
    91L, 88L, 87L, 87L, 86L, 85L, 84L, 86L, 89L, 91L, 97L, 104L, 
    112L, 118L, 123L, 129L, 137L, 141L, 146L, 152L, 159L, 164L, 
    167L, 174L, 181L, 185L, 189L, 195L, 206L, 213L, 219L, 225L, 
    232L, 236L, 242L, 245L, 245L, 246L, 249L, 251L, 251L, 249L, 
    243L, 246L, 238L, 227L, 215L, 204L, 195L, 186L, 167L, 171L, 
    168L, 169L, 173L, 179L, 182L, 180L, 175L, 169L, 163L, 159L, 
    156L, 147L, 143L, 139L, 135L, 133L, 129L, 126L, 123L, 119L, 
    115L, 112L, 108L, 106L, 103L, 102L, 100L, 99L, 102L, 104L, 
    106L, 107L, 108L, 108L, 109L, 109L, 110L, 109L, 109L, 109L, 
    109L, 108L, 105L, 105L, 104L, 100L, 99L, 98L, 97L, 96L, 97L, 
    96L, 95L, 98L, 100L, 102L, 103L, 104L, 106L, 109L, 112L, 
    114L, 117L, 120L, 123L, 126L, 128L, 130L, 129L, 130L, 136L, 
    136L, 135L, 135L, 136L, 141L, 136L, 137L, 138L, 139L, 139L, 
    138L, 137L, 139L, 139L, 138L, 137L, 136L, 136L, 135L, 134L, 
    131L, 130L, 129L, 128L, 126L, 124L, 151L, 147L, 144L, 143L, 
    141L, 140L, 138L, 137L, 134L, 133L, 136L, 140L, 146L, 147L, 
    141L, 129L, 118L, 110L, 106L, 103L, 101L, 100L, 101L, 99L, 
    97L, 95L, 95L, 96L, 95L, 92L, 94L, 93L, 91L, 90L, 90L, 92L, 
    94L, 96L, 97L, 97L, 98L, 100L, 101L, 102L, 103L, 104L, 113L, 
    121L, 127L, 130L, 135L, 138L, 139L, 140L, 142L, 138L, 138L, 
    136L, 133L, 131L, 130L, 128L, 128L, 127L, 127L, 127L, 124L, 
    119L, 118L, 116L, 112L, 107L, 103L, 100L, 99L, 97L, 97L, 
    100L, 103L, 104L, 111L, 122L, 114L, 119L, 122L, 125L, 129L, 
    132L, 129L, 127L, 126L, 121L, 116L, 113L, 113L, 113L, 113L, 
    112L, 114L, 118L, 123L, 127L, 134L, 133L, 140L, 144L, 142L, 
    142L, 141L, 139L, 135L, 134L, 131L, 133L, 134L, 133L, 129L, 
    125L, 129L, 128L, 130L, 132L, 132L, 131L, 128L, 124L, 124L, 
    122L, 120L, 119L, 120L, 122L, 122L, 125L, 126L, 126L, 127L, 
    127L, 126L, 126L, 126L, 127L, 125L, 124L, 126L, 122L, 121L, 
    118L, 114L, 109L, 109L, 105L, 102L, 103L, 106L, 108L, 105L, 
    106L, 106L, 107L, 110L, 112L, 113L, 116L, 120L, 120L, 120L, 
    118L, 122L, 121L, 125L, 199L, 210L)), row.names = c(NA, 500L
), class = "data.frame")

Maybe this is part of your problem. The as.Date() function defaults to calculating in the UTC timezone, but the data are in the local timezone after as.POSIXct(). I'm in the US Eastern timezone. The data data frame in my code is the result of the dput() code in your last post.

data$Date_Time <- as.POSIXct(data$Date_Time, format = "%Y-%m-%d %H:%M:%S")
> data$Date_Time[500]  
[1] "2017-11-04 21:13:00 EDT"
> as.Date(data$Date_Time[500]) #Date is shifted to UTC!!!
[1] "2017-11-05"
> as.Date(data$Date_Time[500], tz = "US/Eastern")  #Specify the timezone
[1] "2017-11-04"
2 Likes

This may do what you want but I used {data.table} rather than {dplyr} so the syntax will look strange.
I called the data.frame you supplied dat1 .

suppressMessages(library(data.table)); suppressMessages(library(tidyverse))

DT <- as.data.table(dat1)
DT[, Date_Time := (ymd_hms(Date_Time))]
last <- DT[, max(Date_Time)]
start <- last - 42460*60 # 4 days in seconds
DT2 <- subset(DT, Date_Time <= last & Date_Time >= start)
DT2[, hhr := hour(Date_Time)] 
setkey(DT2, Date_Time, hhr)

A couple of links that may help you see what I am doing.
data.table in R – The Complete Beginners Guide

A data.table and dplyr tour

OOPS, I forgot you were filtering the data. See new code below.

suppressMessages(library(data.table)); suppressMessages(library(tidyverse))

DT <- as.data.table(dat1)
DT <- na.omit(DT)
DT[, Date_Time := (ymd_hms(Date_Time))]
last <- DT[, max(Date_Time)]
start <- last - 42460*60 # 4 days in seconds
DT2 <- subset(DT, Date_Time <= last & Date_Time >= start)
DT2[, hhr := hour(Date_Time)] 
setkey(DT2, Date_Time, hhr)