timed | R Documentation |
This function interrupts an evaluation after a certain number of seconds.
Note the limitations documented in setTimeLimit
.
timed(expression, seconds = Inf, on_time_out = "silent")
expression |
[ |
seconds |
[ |
on_time_out |
[
|
The value of expression
or, if the evaluation time exceeded, whatever
is specified for on_time_out
.
Other function helpers:
do.call_timed()
,
function_arguments()
,
function_body()
,
function_defaults()
,
quiet()
,
try_silent()
,
variable_name()
foo <- function(x) {
for (i in 1:10) Sys.sleep(x / 10)
return(x)
}
timed(foo(0.5), 1)
timed(foo(1.5), 1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.