Dear Bert and Mel, thanks for your help, but I'm afraid this doesn't solve my problem.
As I wrote in my previous mail (cf quote below) in most cases I will not be able to modify the code of the function that I want to run. This is why I was asking for a wrapper solution similar to what tryCatch does. I have hinted at a very inelegant version that generates a new R process for each function run and kills the process after a given time. But I'm sure there must be something more elegant. I hope I have been clear enough in my problem description. Thanks again, Lukas Here is what I wrote before: Note that mostly these functions are not written by me and not R code (like nlme for example), so it is not feasible to adapt the function itself. Rather, it needs to be a wrapper around the function, similar to tryCatch. On Wed, Apr 2, 2008 at 5:23 PM, mel <[EMAIL PROTECTED]> wrote: > 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@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. > [[alternative HTML version deleted]]
______________________________________________ R-help@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.