try() worked perfectly.  Thanks!
Helen

jim holtman wrote:
> ?try
>
> On Thu, Oct 16, 2008 at 4:46 PM, hgreatrex <h.greatrex@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@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.
>>
>>     
>
>
>
>   


-- 
-----------------------------
Helen Greatrex (PhD Student)
Room 1U09
Department of Meteorology
University of Reading
Earley Gate
PO Box 243
READING
RG6 6BB
----------------------------- 


	[[alternative HTML version deleted]]

