I\'ve got some performance time data in mm:ss.00 format (i.e. 02:15.45, or 00:34.58). R is recognizing the variable as a factor, but I\'d like to convert each performance t
I am not that much comfortable so i don't know if there is any builtin function available, but i have worked out this code.
mmss_to_ss <- function (string)
{
mmss <- strsplit (string, ":", T)
mm <- as.numeric (mmss[[1]][1])
ss <- as.numeric (mmss[[1]][2])
return (mm * 60 + ss)
}
This will accept a time string in mm:ss format and return second values. The code can be easily modified to convert from hh:mm:ss to seconds also.