I have a dataset that contains the following columns:
starttime, endtime and ID
Is there a way to combine the starttime and endtime to a single datetime column whilst grouping by ID?
For example, I have this:
StartTime Endtime ID
12/18/2019 5:20:23 AM 12/18/2019 5:20:24 AM A
12/18/2019 2:01:40 PM 12/18/2019 2:01:47 PM A
I would like this:
DateTimeUTC ID
12/18/2019 5:20:23 AM A
12/18/2019 5:20:24 AM A
12/18/2019 2:01:40 PM A
12/18/2019 2:01:47 PM A
I have tried this:
library(dplyr)
data %>% group_by(ID) %>% coalesce(Starttime, Endtime)
This command yields an error. I will further research this. Any help is appreciated. Thank you.