Learn R Programming

cwhmisc (version 2.1)

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.

Examples

Run this code
time1 <- Sys.time()
  x <- 0
  for (i in 1:100000) x <- x+1
  time2 <- Sys.time()
  dt2str(unclass(time2)-unclass(time1))
  dt2str(unclass(time2)-unclass(time1),,TRUE)

Run the code above in your browser using DataLab