I have a time series as below:
**Date_time**
2018-06-26 17:19:30
2018-06-26 17:20:40
2018-06-26 17:20:41
2018-06-26 17:20:42
[...]
2018-06-26 17:21:36
2018-06-26 17:21:37
2018-06-26 17:21:38
2018-06-26 17:21:39
2018-06-26 17:23:15
I would like to subsample it such as I obtained the following time series (i.e. removing locations recorded every second such as to keep only 1 location / minute roughly)
**Date_time**
2018-06-26 17:19:30
2018-06-26 17:20:40
2018-06-26 17:21:39
2018-06-26 17:23:15
I wrote the following code (but I do not get the expected time series)
tab_subsampled <- tab %>%
mutate(Date_Time = ymd_hms(Date_Time),
year = year(Date_Time), month = month(Date_Time), day = day(Date_Time),
hour = hour(Date_Time), minute = minute(Date_Time), second = second(Date_Time)) %>%
group_by(year, month, day, hour, minute) %>%
slice(n()) %>%
ungroup()
I'd really appreciate some help, thank you very much!