parse_time: Function to parse times into the 'hms' data type.

View source: R/parse_time.R

parse_timeR Documentation

Function to parse times into the hms data type.

Description

Function to parse times into the hms data type.

Usage

parse_time(x)

Arguments

x

Vector of time to be parsed.

Value

hms vector.

Author(s)

Stuart K. Grange

Examples


# 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))


skgrange/threadr documentation built on May 11, 2024, 12:16 p.m.