[R] Suppressing error messages in a for loop
jim holtman
jholtman at gmail.com
Fri Oct 17 02:07:27 CEST 2008
?try
On Thu, Oct 16, 2008 at 4:46 PM, hgreatrex <h.greatrex at rdg.ac.uk> wrote:
>
> Hi,
>
> Is there any way that I can supress error messages so that they don't stop
> for loops running?
>
> I'm using the gstat package and have created a variogram model for the
> double exponential model:
>
> "dexp <- vgm( .5, "Exp", 10,.1, add.to = vgm(.5, "Exp", 100))"
>
> and fitted it using
>
> "dexp.fit <- fit.variogram(temp2, dexp, fit.method=6, debug.level=0)"
>
> Occasionally I get the following error message and the model doesn't fit
>
> "Error in if (direct[direct$id == id, "is.direct"] && any(model$psill <
> :
> missing value where TRUE/FALSE needed"
>
> I don't mind that the model doesn't converge, however the error message
> stops the for loop I'm running at the time (and so stops my code!). Is
> there any way that I can suppress the error message?
>
> Sorry if this is a really simple question, I'm still new to r programming!
> Best wishes
> Helen Greatrex
>
> --
> View this message in context: http://www.nabble.com/Suppressing-error-messages-in-a-for-loop-tp20016800p20016800.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help at 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.
>
--
Jim Holtman
Cincinnati, OH
+1 513 646 9390
What is the problem that you are trying to solve?
More information about the R-help
mailing list