Skip to content
Prev 61879 / 63421 Next

Recent changes to as.complex(NA_real_)

We could also question the value of having an infinite number of NA 
representations in the complex space. For example all these complex 
values are displayed the same way (as NA), are considered NAs by 
is.na(), but are not identical or semantically equivalent (from an Re() 
or Im() point of view):

 ??? NA_real_ + 0i

 ??? complex(r=NA_real_, i=Inf)

 ??? complex(r=2, i=NA_real_)

 ??? complex(r=NaN, i=NA_real_)

In other words, using a single representation for complex NA (i.e. 
complex(r=NA_real_, i=NA_real_)) would avoid a lot of unnecessary 
complications and surprises.

Once you do that, whether as.complex(NA_real_) should return 
complex(r=NA_real_, i=0) or complex(r=NA_real_, i=NA_real_) becomes a 
moot point.

Best,

H.
On 9/22/23 03:38, Martin Maechler wrote: