powered by
Execute an expression with a timeout
withTimeout(expr, timeout = 2)
The result of the expression
The expression to execute
The timeout in seconds. Default is 2.
withTimeout( cat("This works\n"), timeout = 0.2 ) try(silent = TRUE, withTimeout( expr = {Sys.sleep(0.2); cat("This fails\n")}, timeout = 0.1 ))
Run the code above in your browser using DataLab