FYI this has been fixed in R-devel by Martin
Tomas

On 10/23/2017 06:36 PM, Martin Maechler wrote:
Lukas Stadler <lukas.stad...@oracle.com>
     on Mon, 23 Oct 2017 15:56:55 +0200 writes:
     > Hi!
     > I was wondering about the behavior of the range function wrt. logical 
NAs:

     >> range(c(0L, 1L, NA), finite=T)
     > [1] 0 1
     >> range(c(F, T, NA), finite=T)
     > [1] 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

      range(L, *)
      range(as.numeric(L), *)

are equivalent for logical vectors L without attributes.
I'll look into fixing this by an obvious change to (R-level)
range.default().

------

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

or even

     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!

Best,
Martin

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

Reply via email to