On Wed, 29 Jan 2003 louisept@pweh.com wrote:
> Full_Name: Paul Louisell
> Version: 1.6.2
> OS: Windows NT
> Submission from: (NULL) (192.249.47.9)
>
>
> There is a slight bug in the function 'any'. Given a logical vector
(possibly
> including values of 'NA'), the default action of any should be as
follows:
>
> (i) at least one value = T should return T
> (ii) NO values = T
> (a) at least one value = 'NA' should return 'NA'
> (b) all values = F should return F
>
> The problem is that the default action of 'any' is using the
following rule:
>
> (i) at least one value = 'NA' returns 'NA'
> (ii) NO values = 'NA'
> (a) at least one value = T returns T
> (b) all values = F returns F
>
Yes, and the wrong logic is sitting there clearly in logic.c
if (PRIMVAL(op) == 1) { /* ALL */
LOGICAL(s)[0] = haveNA ? NA_LOGICAL : !haveFalse;
} else { /* ANY */
LOGICAL(s)[0] = haveNA ? NA_LOGICAL : haveTrue;
}
Should be easy to fix.
-thomas