I have a series up to 118 hours in the format "118: 34: 42", where 118 hours, 34 minutes, and 42 seconds. The output should be in a few seconds.
I would like to convert this to some type of time in R, but most of the libraries I looked at want to add a date (lubridate, zoo, xts) or return βNAβ because of the clock, being outside the 24-hour range. I can parse the string and return a few seconds, but I'm wondering if there is a faster way.
I'm a little new to R (maybe after 3 months of working with this).
Any help in figuring out how to handle this would be greatly appreciated.
Example:
library(lubridate) x <- c("118:34:42", "114:12:12") tt <- hms(x) Error in parse_date_time(hms, orders, truncated = truncated, quiet = TRUE) : No formats could be infered from the training set. #try another route w <- "118:34:42" tt2 <- hms(w) tt2 #[1] NA z <- "7:02:02" tt3 <- hmw(z) tt3 #[1] "7H 2M 2S"
source share