I would like to convert a time to total milliseconds in R.
Example
13:00 -> 46800000
I would like to convert a time to total milliseconds in R.
Example
13:00 -> 46800000
For the fun of it:
f <- function(v) sapply(strsplit(v, ":", T), function(x) sum(as.numeric(x) * c(60*60, 60, 1)[seq(x)]*1000))
f(c("13:00", "13:00:00", "14:00:00.001"))
# [1] 46800000 46800000 50400001