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

From: mel <mel_at_altk.com>
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



R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html 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 https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive