[Rd] range function with finite=T and logical parameters
maechler at stat.math.ethz.ch
Mon Oct 23 18:36:05 CEST 2017
>>>>> Lukas Stadler <lukas.stadler at oracle.com>
>>>>> on Mon, 23 Oct 2017 15:56:55 +0200 writes:
> I was wondering about the behavior of the range function wrt. logical NAs:
>> range(c(0L, 1L, NA), finite=T)
>  0 1
>> range(c(F, T, NA), finite=T)
>  NA NA
> The documentation is quite clear that "finite = TRUE includes na.rm = TRUE”, so that I would have assumed that these two snippets would produce the same result.
> - Lukas
I agree. Further, another informal "rule" would require that the two calls
are equivalent for logical vectors L without attributes.
I'll look into fixing this by an obvious change to (R-level)
Note for the more advanced ones -- i.e. typical R-devel readers :
T and F are variables in R. For that reason, using the language
keywords TRUE and FALSE is much preferred in such cases. For
some tests we'd even use
T <- FALSE
delayedAssign("F", stop("do not use 'F' when programming with R"))
before running the tests -- just do ensure that the code to be
tested does not use these short forms.
Thank you, Lukas, for the report!
More information about the R-devel