Evaluate an expression and report its elapsed time, like Stata's timer.
Details
The expression is evaluated once. On success, elapsed time is emitted as a
message. Warnings and errors propagate normally. When the expression fails
(or is interrupted) and on_error = TRUE, a message marked as failed
execution reports the elapsed time while the error unwinds; the original
condition object, including its call, is not modified.
Nested or repeated timers each measure everything evaluated inside them, so a later timer in a pipeline reports cumulative time from its own start.
See also
Other utility functions:
capture(),
set_seed()