parse_time | R Documentation |
hms
data type.Function to parse times into the hms
data type.
parse_time(x)
x |
Vector of time to be parsed. |
hms
vector.
Stuart K. Grange
# Some different time formats
times <- c(
"44:41", "44:41.3", "01:38:44.566", "1:38:4", "24:00:00", "24:00",
"68:10", "78:12:12", "4:04.1", "4:04", NA, "110:42:00"
)
# Parse
parse_time(times)
# As seconds
as.numeric(parse_time(times))
# parse_time will also handle numeric vectors, there is an assumption that
# the elements are stored as seconds
parse_time(c(55, 555.9, 60))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.