[Rd] NA and NaN in function identical
Prof Brian Ripley
ripley at stats.ox.ac.uk
Wed Aug 29 17:53:05 CEST 2007
On Wed, 29 Aug 2007, Petr Savicky wrote:
> The help page for function identical says:
> 'identical' sees 'NaN' as different from 'as.double(NA)', but all
> 'NaN's are equal (and all 'NA' of the same type are equal).
> However, we have
> x <- NaN
> y <- as.double(NA)
> x #  NaN
> y #  NA
> identical(x,y) #  TRUE
> In my opinion, NaN and as.double(NA) should be distinguished as the
> help page suggests.
And sometimes they are:
so it is a bug. A quicker version:
identical(NaN, NA_real_) == identical(NA_real_, NaN)
was false, fixed now, thanks for spotting it.
> Tested under R version 2.5.1 Patched (2007-08-19 r42638) on Linux (CPU Xeon).
> Petr Savicky.
> R-devel at r-project.org mailing list
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