[R] how to ignore error messages?
Dieter Menne
dieter.menne at menne-biomed.de
Mon Jun 11 18:26:43 CEST 2007
Jianping Jin <jjin <at> email.unc.edu> writes:
...
> I wrote a code to iterate a non-linear fit with a set of data. The entire
> process didn't implemented to the end because an error message, "singular
> gradient". I knew that some sub-sets (columns) do not fit my formula well
> and may result in parameters going to infinity. It is pretty hard to remove
> those sub sets before running the code since that will take a lot of time.
>
> I added some logic assessments prior to running nonlinear fit. It helped
> but some exceptions still existed. I am wondering if there is any way in R
> by which I can continue to run the entire code to the end by ignoring the
> error message?
...
?try
Or, even easier, use nlsList in nlme, which does exactly what you want, handling
convergence errors graciously.
Dieter
More information about the R-help
mailing list