timed {oeli} | R Documentation |
Interrupt long evaluations
Description
This function interrupts an evaluation after a certain number of seconds.
Note the limitations documented in setTimeLimit
.
Usage
timed(expression, seconds = Inf, on_time_out = "silent")
Arguments
expression |
[ |
seconds |
[ |
on_time_out |
[
|
Value
The value of expression
or, if the evaluation time exceeded, whatever
is specified for on_time_out
.
See Also
Other function helpers:
do.call_timed()
,
function_arguments()
,
function_body()
,
function_defaults()
,
quiet()
,
try_silent()
,
variable_name()
Examples
foo <- function(x) {
for (i in 1:10) Sys.sleep(x / 10)
return(x)
}
timed(foo(0.5), 1)
timed(foo(1.5), 1)
[Package oeli version 0.7.0 Index]