[Rd] NA warnings for r<distr>() {aka "patch for random.c"}

Patrick Burns pburns at pburns.seanet.com
Sat Mar 8 10:43:44 CET 2008


Martin Maechler wrote:

> [ ... ]
>
>But actually, part of the changed behavior may be considered
>undesirable:
>
>  rnorm(2, mean = NA)
>
>which gives two NaN's  would now produce a warning,
>where I could argue that 
>   'arithmetic with NAs should give NAs without a warning'
>since
>  1:2 + NA
>also gives NAs without a warning.
>
>So we could argue that a warning should *only* be produced in a
>case where the parameters of the distribution are not NA.
>
>What do others (particularly R-core !) think? 
>  
>

I think the answer depends on the probability that
the user realizes that the parameter is NA.  Obviously
the user should know if 'rnorm' is used directly.  If it
is used inside a function, then the user probably doesn't
know.  Not warning in such a case means that tracking
down the ultimate cause of the problem could be harder.
However, it seems to me that the function calling 'rnorm'
is really the one responsible for warning the user.

Pat


[ ... ]



More information about the R-devel mailing list