Pretty formatting of seconds
Usage
pretty_sec(sec, compact = FALSE)
Arguments
- sec
Numeric vector of seconds.
- compact
If true, then only the first non-zero
unit is used. See examples below.
Value
Character vector of formatted time intervals.
Examples
pretty_sec(c(1337, 13370, 133700, 1337000, 13370000))
#> [1] "22m 17s" "3h 42m 50s" "1d 13h 8m 20s" "15d 11h 23m 20s"
#> [5] "154d 17h 53m 20s"
pretty_sec(c(1337, 13370, 133700, 1337000, 13370000),
compact = TRUE)
#> [1] "~22m" "~3h" "~1d" "~15d" "~154d"