From tomas.kalibera at gmail.com  Tue Nov  7 15:55:57 2017
From: tomas.kalibera at gmail.com (Tomas Kalibera)
Date: Tue, 7 Nov 2017 15:55:57 +0100
Subject: [Rd] range function with finite=T and logical parameters
In-Reply-To: <23022.6773.353931.80946@stat.math.ethz.ch>
References: <A7D1EB89-0A3C-456D-A73C-6E3B2B11DF3E@oracle.com>
 <23022.6773.353931.80946@stat.math.ethz.ch>
Message-ID: <8d573470-0df9-cf6e-e780-ef34f166da0d@gmail.com>

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

On 10/23/2017 06:36 PM, Martin Maechler wrote:
>>>>>> Lukas Stadler <lukas.stadler at 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 at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel



[Rd] range function with finite=T and logical parameters
Tomas Kalibera