I have a large data set containing time in hh:mm:ss format and I would like to convert these to a decimal format while ignoring the hours (hh). I have used strptime but this
You can use stringsplit and sapply
stringsplit
sapply
dat<-c('00:01:38','01:18:30') sapply(strsplit(dat,":"), function(x) { x <- as.numeric(x) x[1]*60+x[2]+x[3]/60 } )
Result:
[1] 1.633333 78.500000
Credits go to @Joris Meys
Just extended his example: How to convert time (mm:ss) to decimal form in R