Re: [R] Suppressing warning messages

From: Martin Maechler <maechler_at_stat.math.ethz.ch>
Date: Mon 16 May 2005 - 20:45:49 EST

>>>>> "UweL" == Uwe Ligges <ligges@statistik.uni-dortmund.de> >>>>> on Sun, 15 May 2005 16:41:22 +0200 writes:

    UweL> 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@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!

    UweL> Yes! In both cases you should really look why you are     UweL> using *conditions of length > 1*!

yes, indeed!
This is a bug almost always (my subjective probability : 0.995)

Maybe you want to use

     if(any(...))
or if(all(...))
instead of the current if(...)

    UweL> And if this is intended, you certainly want to use "ifelse()" rather     UweL> than "if(){} else{}".

(from my above guess, the probability for this would be about 1:200)

Martin

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

______________________________________________
R-help@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 Received on Mon May 16 20:51:54 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:31:46 EST