From pburns at pburns.seanet.com  Sat Mar  8 10:43:44 2008
From: pburns at pburns.seanet.com (Patrick Burns)
Date: Sat, 08 Mar 2008 09:43:44 +0000
Subject: [Rd] NA warnings for r<distr>() {aka "patch for random.c"}
In-Reply-To: <18385.19126.4852.755058@stat.math.ethz.ch>
References: <20080229181940.457c9bf7@berwin-nus1>	<18379.49661.242974.779574@stat.math.ethz.ch>	<20080305202624.7f1c54ea@berwin-nus1>
	<18385.19126.4852.755058@stat.math.ethz.ch>
Message-ID: <47D25FD0.4000705@pburns.seanet.com>

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


[ ... ]



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