I should have said: The below only works if you can get it into the function code. If you cannot, and the function has no options that allow you to limit execution time or iterations, then I don't see how you can do it.
-- Bert On Sat, Aug 20, 2011 at 2:16 PM, Bert Gunter <bgun...@gene.com> wrote: > ?proc.time > > e.g. something like > > time0 <- proc.time()[2] > state <- "not converged" > while(proc.time()[2] < time0[2] + 600 ) ## 10 minutes > { > ##... Do your thing... > if(get an answer) {state <- "converged"; break} > } > > Refinement required, but you get the idea. > > Cheers, > Bert > > On Sat, Aug 20, 2011 at 1:52 PM, Immanuel <mane.d...@googlemail.com> wrote: >> Hello all, >> >> I'm running a parameter grid optimization ( ksvm, kernlab package) and the >> optimizer >> seems not to converge for certain parameters and stays in a infinity loop. >> Would it be possible to abort the execution after x-seconds and continue >> with the next parameter set? Which R function do need to use to accomplish >> this? >> >> I had a look at, try() etc. but they didn't seem so fit my needs. >> I would appreciate any suggestions.. >> >> best regards >> >> ______________________________________________ >> 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. >> > > > > -- > "Men by nature long to get on to the ultimate truths, and will often > be impatient with elementary studies or fight shy of them. If it were > possible to reach the ultimate truths without the elementary studies > usually prefixed to them, these would not be preparatory studies but > superfluous diversions." > > -- Maimonides (1135-1204) > > Bert Gunter > Genentech Nonclinical Biostatistics > -- "Men by nature long to get on to the ultimate truths, and will often be impatient with elementary studies or fight shy of them. If it were possible to reach the ultimate truths without the elementary studies usually prefixed to them, these would not be preparatory studies but superfluous diversions." -- Maimonides (1135-1204) Bert Gunter Genentech Nonclinical Biostatistics 467-7374 http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm ______________________________________________ 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.