I have a vector of event times in the form of hours, minuets and seconds but i now wish to convert these all to minuets, for example 01:02:18 would become 62.
my data
times
"01:02:18" "01:47:37" "01:18:48" "01:32:54" "01:09:41" "01:50:30"
code tried with no joy
time = format(strptime(matchtime,"%H:%M:%S"),'%M')
Guess something could be done by adding the hours and minuets but unsure on how to do this too
>Solution :
If we want to extract the minutes and hours
library(lubridate)
v1 <- hms(times)
v1@hour * 60 + v1@minute
[1] 62 107 78 92 69 110
Or to include the seconds as well
period_to_seconds(hms(times))/60
[1] 62.30000 107.61667 78.80000 92.90000 69.68333 110.50000