stopwatch: Time an expression

View source: R/stopwatch.r

stopwatchR Documentation

Time an expression

Description

This is a wrapper for system.time, but returns only the total elapsed time.

Usage

stopwatch(expr)

Arguments

expr

Valid R expression to be timed.

Value

(lubridate::period) total elapsed time

Examples

## Not run: 

# This will return time_taken and a_result
time_taken <- stopwatch({
  a_result <- Sys.sleep(60)
})

## End(Not run)

baslat/sak documentation built on April 14, 2025, 4:14 p.m.