Re: [R] Stopping a function execution automatically after a given time

From: mel <>
Date: Wed, 02 Apr 2008 17:23:56 +0200

Lukas Rode a écrit :

> Nowever, with regard to #2, I am lost. I would like to set a maximum time
> limit (say, 1 minute) and if my procedure is still running then, I would
> like to move on to the next model.

begin_time = as.difftime(format(Sys.time(), '%H:%M:%S'), units='secs'); for(...)
  current_time = as.difftime(format(Sys.time(), '%H:%M:%S'), units='secs');   delay = current_time - begin_time;
  if (delay>60) return();

a counter may also be enough mailing list PLEASE do read the posting guide and provide commented, minimal, self-contained, reproducible code. Received on Wed 02 Apr 2008 - 15:55:08 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 02 Apr 2008 - 16:30:26 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive