Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

dt2str

Convert time difference to string.


Description

Convert time difference in seconds to string depending on switch.

Usage

dt2str(dt,dec=0,verbose=FALSE)

Arguments

dt

Time difference in seconds

dec

Places in decimal fraction of seconds

verbose

If TRUE, then delimited by "hours minutes seconds", else by ":"

Value

String representing the time difference, with dec decimals in seconds.

Note

Enclosing the above statements in a function is likely to show zero time.

Author(s)

Christian W. Hoffmann <christian@echoffmann.ch>

Examples

t1 <- unclass(Sys.time())
  x <- 0;  for (i in 1:1.e6) x <- x+1
  t2 <- unclass(Sys.time())
  dt2str(t2-t1,3) # 00:00:0.070, Macbook Pro 2016, 2.2 GHz, 16GB RAM

cwhmisc

Miscellaneous Functions for Math, Plotting, Printing, Statistics, Strings, and Tools

v6.6
GPL (>= 2)
Authors
Christian W. Hoffmann
Initial release
2018-08-24, 10:40:10

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.