Dear all, I often need to execute functions repeatedly (thousands or more times). While doing so, I encounter two types of problems:
1.) In some models, the estimation process fails due to convergence problems 2.) Some models will run forever. My solution to #1 is to use tryCatch around the function call so that my script does not stop if one of the models will raise an error. This works fine. 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. I guess a brute-force solution would be to start a new R process for each model from my R script and to kill the process using system commands after a given time. However, restarting the R interpreter each time sounds very inelegant. Are there any versions that work within a single script? Or alternative suggestions? 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. Any help appreciated! Kind regards, Lukas [[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.