Learn R Programming

bayescount (version 0.8.2)

timestring: CALCULATE THE ELAPSED TIME IN SENSIBLE UNITS

Description

Function to calculate the elapsed time between 2 time periods (in seconds), or to calculate a number of seconds into a time measurement in more sensible units. Used by the bayescount function.

Usage

timestring(time1, time2=NA, units=NA, show.units=TRUE)

Arguments

Value

A time measurement, with or without units.

See Also

bayescount

Examples

Run this code
# time how long it takes to complete a task:

pre.time <- Sys.time()
for (i in 1:10000000) hold <- exp(100)  # PROCESS TO TIME
post.time <- Sys.time()
timestring(pre.time, post.time)

# Convert 4687 seconds into hours:

timestring(4687, units='hours', show.units=FALSE)

Run the code above in your browser using DataLab