How to convert numbers that represent time in hours from numeric to HMS format.
for example:
8.0 -> 08:00:00
0.5 -> 00:30:00
0.25 -> 00:15:00
Convert to seconds, make use of seconds_to_periods
from lubridate
and change it to hms
hms::hms(lubridate::seconds_to_period(floor(v1 * 60 *60)))
#08:00:00
#00:30:00
#00:15:00
v1 <- c(8, 0.5, 0.25)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With