hhmmss: HH:MM:SS conversion

Description Usage Arguments Examples

Description

Convert between seconds and the more readable "HH:MM:SS" time format.

Usage

1
2
3
hms_to_sec(hms)

sec_to_hms(sec, digits = 1, strip_zeros = FALSE)

Arguments

hms

character string; a time in the form "HH:MM:SS" ("HH:" is optional).

sec

numeric; seconds values.

digits

numeric (scalar); number of decimal places to be used for the seconds value in the "hours:minutes:seconds" string.

strip_zeros

logical; remove leading zeros? E.g. "00:26:01" becomes "26:01".

Examples

1
2
3
x <- c("00:21:05", "25:51", NA, "00:26:01.1", "01:05:02.0")
(x <- hms_to_sec(x))
(x <- sec_to_hms(x, strip_zeros = TRUE))

jmackie4/elpatron documentation built on May 19, 2019, 12:49 p.m.