matrix() can't handle NaN (PR#193)

Bill Simpson Bill Simpson <>
Tue, 11 May 1999 14:51:23 +0000 (GMT)

On Tue, 11 May 1999, Ben Bolker wrote:
>   One *could* extend the default na.strings in read.table to 
> c("NA","NaN"), which would take care of the immediate problem but might 
> further blur the subtle distinction between NA and NaN.  I don't know 
> how/whether one would want to extend read.table() to deal with Inf/-Inf 
> in data files ... (I think not).

My attitude is that if NaN is a recognized "number" by the numerical
analysts (the guys who write the floating point standards), why not treat
it as such throughout R? But maybe this opens a can of worms.

In my example, I was expecting to have the z matrix for an image plot with
NaNs in it. Then I was going to convert them either to zeros or NAs prior
to making the plot.

I would put the onus on the user to deal with the NaNs prior to
passing the data onto some other function. I would not favour some
automatic conversion of NaN into NA.


r-devel mailing list -- Read
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: