pretty_sec: Pretty formatting of seconds

Description Usage Arguments Value See Also Examples

View source: R/time.R

Description

Pretty formatting of seconds

Usage

1
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.

See Also

Other time: pretty_dt(), pretty_ms()

Examples

1
2
3
4
pretty_sec(c(1337, 13370, 133700, 1337000, 13370000))

pretty_sec(c(1337, 13370, 133700, 1337000, 13370000),
           compact = TRUE)

Example output

[1] "22m 17s"          "3h 42m 50s"       "1d 13h 8m 20s"    "15d 11h 23m 20s" 
[5] "154d 17h 53m 20s"
[1] "~22m"  "~3h"   "~1d"   "~15d"  "~154d"

prettyunits documentation built on Jan. 24, 2020, 9:06 a.m.