Turn string time into decimal

time_hms2deci(x, unit = "hour")

Arguments

x

string of class lubridate::hms "HH:MM:SS"

unit

unit to convert to

Value

numeric vector

Examples

time <- lubridate::hms("02:33:12")
time_hms2deci(time)
#> [1] 2.65
time_hms2deci(time, "minute")
#> [1] 159