[Rd] Re: negative indices and NAs in R 1.9.0.alpha

Prof Brian Ripley ripley at stats.ox.ac.uk
Mon Mar 22 19:21:28 CET 2004


Yes, it was intended. It worked before by integer overflow, but only on 
32-bit platforms: it crashed on 64-bit platforms.  In other words, it was 
an uncaught error in 1.8.1.

On Mon, 22 Mar 2004, Martin Maechler wrote:

> >>>>> "JensOe" == Jens Oehlschlägel <joehl at web.de>
> >>>>>     on Mon, 22 Mar 2004 18:03:08 +0100 writes:
> 
>     JensOe> I was notfied that my package ref fails R CMD CHECK
>     JensOe> under 1.9.0 Alpha.  I downloaded the windows version
>     JensOe> of 1.9.0 Alpha (dated 2004-03-17) and package ref
>     JensOe> passes R CMD CHECK without any complaints.
> 
>     JensOe> The daily checks suggest the problem arises in
>     JensOe> example(optimal.index)
> 
>     JensOe> Error in identical(l[i], l[optimal.index(i, n =
>     JensOe> length(l), strict = FALSE)]) : only 0's may mix with
>     JensOe> negative subscripts
> 
>     JensOe> where negative subscripts are mixed with NAs (which
>     JensOe> was legal in versions prior 1.9.0).
> 
>     JensOe> Is it an intended change not to allow NA mix with
>     JensOe> negative subscripts any longer?  (I did not find any
>     JensOe> hint in NEWS)
> 
> A shorter version is
> 
>   > x <- 1:9; x[-c(-1,NA,3:5)]
>   Error: only 0's may mix with negative subscripts
> 
> which used to simply give
> 
>   > x <- 1:9; x[-c(1,NA,3:5)]
>   [1] 2 6 7 8 9
> 
> and is the same if there was no NA in the index -- without a warning;
> not necessarily desirable as well.
> 
> ---------
> 
> However, the current NEWS  file does say
> 
> 
>     o   Negative subscripts that were out of range or NA were not handled 
>         correctly.
> 
> 
> R 1.9.0 (beta)'s behavior seems to match the one of S-plus here,
> but that alone is not convincing enough IMO.
> 
> Regards, Martin
> 
> ______________________________________________
> R-devel at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-devel
> 
> 

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



More information about the R-devel mailing list