hms.to.seconds: Converts a time value given in H:M:S format to the number of...

Description Usage Arguments Value See Also Examples

View source: R/hms_to_seconds.R

Description

This function is very similar to strptime with the %X conversion specification. Anything with three numbers between two colons is interpreted as a time, no consistency check is performed on the actual hour, minute and second values. Thus, strings like 25:15:00 and 23:78:101 also will be converted. Incorrectly formatted strings are converted to NA with a warning.

Usage

1

Arguments

x

A (vector of) strings in H:M:S format.

Value

A (vector of) integer values of the same length as x.

See Also

strptime

Examples

1
2
3
hms.to.seconds(c("00:00:01", "00:01:00", "01:00:00"))
hms.to.seconds(c("25:15:00", "23:78:101"))
hms.to.seconds("invalid")

Example output

`hms.to.seconds()` is deprecated, use `hms::parse_hms()` instead.
[1]    1   60 3600
[1] 90900 87581
[1] NA
Warning message:
In hms.to.seconds("invalid") : NAs introduced by coercion

kimisc documentation built on May 2, 2019, 6:09 p.m.