[prev in list] [next in list] [prev in thread] [next in thread] 

List:       r-devel
Subject:    Re: [Rd] range function with finite=T and logical parameters
From:       Tomas Kalibera <tomas.kalibera () gmail ! com>
Date:       2017-11-07 14:55:57
Message-ID: 8d573470-0df9-cf6e-e780-ef34f166da0d () gmail ! com
[Download RAW message or body]

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@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


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic