[R] Is it possible to coerce R to continue proceeding the next command in a loop after an error message ?
Duncan Murdoch
murdoch at stats.uwo.ca
Sun Jul 17 02:51:48 CEST 2005
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
More information about the R-help
mailing list