« Hold on to your hats: it's World Statistics Day! | Main | A workflow for R »

October 21, 2010


Feed You can follow this conversation by subscribing to the comment feed for this post.

Er, I don't think R introduced missing values, these are just the IEEE 754 QNaN and widely supported in most languages. The fact that QNaN + other value = QNaN is defined by IEEE 754 and invariably implemented in hardware and so nothing to do with R.

What's more the R documentation shows a serious lack of understanding of what an IEEE 754 QNaN is when it discusses equality testing.

R is still awesome though!!

Hmm, I'm not sure that's quite correct: NA as a *statistical* missing value is still quite different from QNaN, I believe. For example, the fact that TRUE || NA is TRUE and that FALSE && NA is FALSE (in both cases, not NA) is different from the QNaN spec, right?

I think the fact that R's NA is different from QNaN is by design.

TRUE || NA doesn't mean anything in floating point context. IEEE 754 talks about floating point rather than logical.

NA is implemented as a QNAN - there are many to choose from. The documentation of is.nan talks about not comparing for equality but IEEE 754 is subtle. NaNs compare not equal to all FP values. So NA<>NA at least in terms of the IEEE 754 spec.

If you think about it, there is no other tenable way of implementing NA. If you were to hold FP values in objects that that stored flags for properties like missing, infinity, nan etc. then the performance when mapped to hardware would be dire. The use of IEEE 754 is both sensible and forced.

Also, TRUE || NA is TRUE and FALSE && NA, isn't just short circuit evalution? Once you get to TRUE || you can stop evaluating and likewise with FALSE &&.

> 0/0
[1] NaN
> x = 0/0
> TRUE || x
[1] TRUE
> FALSE && x

sometime it is important to "re-invent" wheel if the the original wheel was designed poorly.....


Is your point is the IEEE 754 is designed poorly?

no David. I am not talking about missing value here. My point is that not all "redundancy" is bad and parallel efforts are needed for important issues.

The comments to this entry are closed.

Search Revolutions Blog

Got comments or suggestions for the blog editor?
Email David Smith.
Follow revodavid on Twitter Follow David on Twitter: @revodavid
Get this blog via email with Blogtrottr