hms: Converts time in seconds to hrs mins secs.

Description Usage Arguments Value Author(s) See Also Examples

View source: R/hms.R

Description

Converts a time in seconds (or an object of class 'proc_time' as returned by system.time) to a matrix of hours, minutes, seconds, or, if char > 0, a character string with time in hrs, mins, secs.

Usage

1
hms(x, char = 0)

Arguments

x

Either a vector of times in seconds, or a (single) proc_time object.

char

Controls the type of output; see Value.

Value

If char == 0, a matrix with named columns for hours, mins, secs; the matrix may have only one row.

If char == 1, a vector of strings of the form "6 mins 20 secs".

If char == 2, a vector of strings of the form "00:06:20".

Author(s)

Mike Meredith, 10 Nov 2008

See Also

See also proc.time and system.time

Examples

1
2
3
4
5
6
7
hms(1234)
#      hrs  mins  secs 
#[1]     0    20    34 
hms(1234, char=1)
# "20 mins 34 secs"
hms(12345, char=2)
# "03:25:45"

mikemeredith/MMmisc documentation built on Nov. 8, 2019, 11:34 p.m.