Displaying 6 results from an estimated 6 matches for "r85233".
Did you mean:
85233
2023 Nov 06
1
c(NA, 0+1i) not the same as c(as.complex(NA), 0+1i)?
...> Certainly it's messing with my understanding of how c() behaves, e.g. in ?c
>> All arguments are coerced to a common type which is the type of the
> returned value
I think you have confused yourself, and everything behaves as expected:
As we now have (in R-devel, since {r85233 | maechler | 2023-09-29 })
? ?as.complex(x)? now returns ?complex(real=x, imaginary=0)?
for _all_ numerical and logical ?x?, notably also for ?NA?
or ?NA_integer_?.
==> as.complex(NA) is indeed complex(real = NA, imaginary = 0)
And now, in your
c(as.complex(NA), 0+1i)
you are...
2023 Nov 07
1
c(NA, 0+1i) not the same as c(as.complex(NA), 0+1i)?
...my understanding of how c() behaves,
> e.g. in ?c
>
> >> All arguments are coerced to a common type which is the type of the
> > returned value
>
> I think you have confused yourself, and everything behaves as expected:
>
> As we now have (in R-devel, since {r85233 | maechler | 2023-09-29 })
>
> ? ?as.complex(x)? now returns ?complex(real=x, imaginary=0)?
> for _all_ numerical and logical ?x?, notably also for ?NA?
> or ?NA_integer_?.
>
> ==> as.complex(NA) is indeed complex(real = NA, imaginary = 0)
>
> And now, in your...
2023 Nov 08
1
c(NA, 0+1i) not the same as c(as.complex(NA), 0+1i)?
...>> All arguments are coerced to a common type which is the type of the
> >> > returned value
> >>
> >> I think you have confused yourself, and everything behaves as expected:
> >>
> >> As we now have (in R-devel, since {r85233 | maechler | 2023-09-29 })
> >>
> >> ? ?as.complex(x)? now returns ?complex(real=x, imaginary=0)?
> >> for_all_ numerical and logical ?x?, notably also for ?NA?
> >> or ?NA_integer_?.
> >>
> >> ==> as.complex(NA...
2023 Nov 09
1
c(NA, 0+1i) not the same as c(as.complex(NA), 0+1i)?
...rguments are coerced to a common type which is the type of the
>> >> > returned value
>> >>
>> >> I think you have confused yourself, and everything behaves as expected:
>> >>
>> >> As we now have (in R-devel, since {r85233 | maechler | 2023-09-29 })
>> >>
>> >> ? ?as.complex(x)? now returns ?complex(real=x, imaginary=0)?
>> >> for_all_ numerical and logical ?x?, notably also for ?NA?
>> >> or ?NA_integer_?.
>> >>
>> >> ==...
2023 Nov 05
2
c(NA, 0+1i) not the same as c(as.complex(NA), 0+1i)?
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; the latter is essentially (via
coerceVector() in C) what's generated by our
2023 Nov 06
1
c(NA, 0+1i) not the same as c(as.complex(NA), 0+1i)?
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 discussed, but it does look a bit unfortunate that usage patterns like c(NA, 0+1i) does not give complex NA