On 2023-11-09 3:13 am, Martin Maechler wrote:
Mikael Jagan
on Wed, 8 Nov 2023 11:13:18 -0500 writes:
> So, to summarize, the open questions are:
> (1) Should as.complex(NA_character_) give complex(r=NA_real_, i=0)
> instead of NA_complex_?
> (2) Should the first
> Mikael Jagan
> on Wed, 8 Nov 2023 11:13:18 -0500 writes:
> So, to summarize, the open questions are:
> (1) Should as.complex(NA_character_) give complex(r=NA_real_, i=0)
> instead of NA_complex_?
> (2) Should the first argument in c(NA, x) and c(NA_integer_, x),
So, to summarize, the open questions are:
(1) Should as.complex(NA_character_) give complex(r=NA_real_, i=0)
instead of NA_complex_?
(2) Should the first argument in c(NA, x) and c(NA_integer_, x),
where typeof(x) == "complex", be promoted to complex(r=NA_real_, i=0)
> Michael Chirico
> on Mon, 6 Nov 2023 23:18:40 -0800 writes:
> Thanks Martin. My hang-up was not on what the outcome of as.complex(NA)
> should be, but rather, how I should read code like c(x, y) generally. Till
> now, I have thought of it like 'c(x, y)' is c(as(x,
> peter dalgaard
> on Mon, 6 Nov 2023 11:59:51 +0100 writes:
> Hmm, it is not actually at odds with help(c), it is just that the
autocoercion works different that it used to, so that
> as.complex(NA) == as.complex(NA_real) == NA_real_+0i)
> which now differs from
>
Thanks Martin. My hang-up was not on what the outcome of as.complex(NA)
should be, but rather, how I should read code like c(x, y) generally. Till
now, I have thought of it like 'c(x, y)' is c(as(x, typeof(y)), y)` when
"type(y) > type(x)". Basically in my mind, "coercion" in R <->
as.(.) (or
> Michael Chirico
> on Sun, 5 Nov 2023 09:41:42 -0800 writes:
> This is another follow-up to the thread from September
> "Recent changes to as.complex(NA_real_)".
> A test in data.table was broken by the changes for NA
> coercion to complex; the breakage essentially
Hmm, it is not actually at odds with help(c), it is just that the autocoercion
works different that it used to, so that
as.complex(NA) == as.complex(NA_real) == NA_real_+0i)
which now differs from
NA_complex
although both print as NA.
I haven't been quite alert when this change was
This is another follow-up to the thread from September "Recent changes to
as.complex(NA_real_)".
A test in data.table was broken by the changes for NA coercion to complex;
the breakage essentially comes from
c(NA, 0+1i)
# vs
c(as.complex(NA), 0+1i)
The former is the output we tested against;