[R] Suppressing warning messages

Uwe Ligges ligges at statistik.uni-dortmund.de
Sun May 15 16:41:22 CEST 2005


Kjetil Brinchmann Halvorsen wrote:
> Tolga Uzuner wrote:
> 
>> How do I suppress the following ?
>>
>> Warning messages:
>> 1: the condition has length > 1 and only the first element will be used
>> in: if (strike == forward) atmvol(forward, t, alpha, beta, rho, upsilon)
>> else {
>> 2: the condition has length > 1 and only the first element will be used
>> in: if (x(z) == 0) 1 else z/x(z)
>>
>> ______________________________________________
>> 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
>>
>>
>>
> Maybe better to understand what generates the warning!

Yes! In both cases you should really look why you are using *conditions 
of length > 1*! And if this is intended, you certainly want to use 
"ifelse()" rather than "if(){} else{}".

Uwe Ligges


> To assure you are uninformed, say
> options(warn=-1)
> 
> Kjetil
>




More information about the R-help mailing list