I am trying to design a function which calls nls - does estimates for a lot of different models and then puts the estimates all in a file. My problem is that if nls fails for whatever reason on one model, the rest of the models do not get evaluated and the execution is halted (running in batch mode). My question is what syntax should I use inside the function, which will trap the error and continue evaluations of the other models? for example my.nls <- function(model= something, etc..){ call nls and evaluate the model. if nls does fails (singular gradient - whatever reason) trap error and continue. in the end - tell me which model failed and show me the error and the estimates for the model parameters for which nls converged } I am looking at the documentation for the try() function, but I am unsure of the exact syntax. Any help is greatly appreciated. TIA. Partha. -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._