I have a dataframe with a column containing a column of type character describing working time. I want to change that character vector to a numeric value in order to make plots and infer things about it. One difficulty lies in having two different formats:
I either have 01.09:55:00 meaning 1 day, 9 hours, 55 minutes and 0 seconds or if one full day isn't reached, 04:30:00 meaning 4 hours, 30 minutes and 0 seconds. If it makes it easier, more than 100 days will not be reached. The hours, minutes, seconds are always there, but not the number of days and the seperation is different.
I can already handle the second format using this to get the time in minutes:
MyData$Working_Time_Total = strptime(MyData$Working_Time_Total, format = "%H:%M:%S") MyData$Working_Time_Total = (MyData$Working_Time_Total$sec + MyData$Working_Time_Total$min * 60 + MyData$Working_Time_Total$hour * 3600) / 60
I tried to attempt some splitting procedure that seperates on the '.' and later recombines it somehow appropriately, however that leads to issues if there is no '.'. I appreciate any help on this issue to get my desired result, which is a numeric vector that contains the time in minutes.