Yimeng Lu
2005-Jul-17 00:34 UTC
[R] Is it possible to coerce R to continue proceeding the next command in a loop after an error message ?
Hello R-users, In a loop, if a function, such as "nls", gives an error, is it possible to coerce R to continue proceeding the next command with the same loop? Thanks so much for your advice! Hanna Lu [[alternative HTML version deleted]]
Duncan Murdoch
2005-Jul-17 00:51 UTC
[R] Is it possible to coerce R to continue proceeding the next command in a loop after an error message ?
Yimeng Lu wrote:> Hello R-users, > > In a loop, if a function, such as "nls", gives an error, is it possible to > coerce R to continue proceeding the next command with the same > loop? >Yes, see the try() function. The basic usage is something like value <- try( some calculation ) if (inherits(value, "try-error")) handle the error else handle a correct calculation Duncan Murdoch
Spencer Graves
2005-Jul-17 01:11 UTC
[R] Is it possible to coerce R to continue proceeding the next command in a loop after an error message ?
?try spencer graves Yimeng Lu wrote:> Hello R-users, > > In a loop, if a function, such as "nls", gives an error, is it possible to > coerce R to continue proceeding the next command with the same > loop? > > Thanks so much for your advice! > > Hanna Lu > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html-- Spencer Graves, PhD Senior Development Engineer PDF Solutions, Inc. 333 West San Carlos Street Suite 700 San Jose, CA 95110, USA spencer.graves at pdf.com www.pdf.com <http://www.pdf.com> Tel: 408-938-4420 Fax: 408-280-7915
Dieter Menne
2005-Jul-18 06:42 UTC
[R] Is it possible to coerce R to continue proceeding the next command in a loop after an error message ?
Yimeng Lu <yl2058 <at> columbia.edu> writes:> In a loop, if a function, such as "nls", gives an error, is it possible to > coerce R to continue proceeding the next command with the same > loop?You may also have a look at nlsList in package(nlme). In handles errors returns a nice list of result. Dieter