matrix() can't handle NaN (PR#193)
Wed, 12 May 1999 13:07:00 +0200 (MET DST)
Can we backtrack here. I have just tried the original example on Solaris,
and matrix() _can_ handle NaN with a mature ANSI C library.
toucan% cat > junk.dat
x y z
1 1 1
1 2 2
2 1 NaN
2 2 4
R : Copyright 1999, The R Development Core Team
Version 0.64.1 (May 8, 1999)
> data <- read.table("junk.dat",header=TRUE)
[1,] 1 NaN
[2,] 2 4
So on Solaris NaNs are read as such, and on Linux they are not.
> From: Peter Dalgaard BSA <firstname.lastname@example.org>
> Date: 12 May 1999 11:27:17 +0200
> We do allow them as constants in the language itself, so I suppose we
> could do it in read.table as well - this really means inside
> as.double, I suppose. The prototype does this:
> Splus> is.nan(as.double("NaN"))
>  T
and so does my R on Solaris. On Linux
Warning: NAs introduced by coercion
so I think there is a problem with Linux versions specifically. The
conversion is done by strtod. Solaris says (same man page)
If str is NaN, then atof() returns NaN.
This sort of mess is my underlying objection: should we be assuming
IEEE arithmetic, let alone a particular implementation of it?
Brian D. Ripley, email@example.com
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 272860 (secr)
Oxford OX1 3TG, UK Fax: +44 1865 272595
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: firstname.lastname@example.org