I am weighing in even though I know nothing. in tryCatch define an error handler
error = function(e){ text <- print(e) # surely there must be better ways # parse text for substring 'optim' or more strongly characteristic substrings # you have already seen to emerge from optim # do what you have to do if such is detected } Sorry if this answer seems trivial. Michael Meyer ______________________________________________ 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.