Re: [Rd] Recent changes to as.complex(NA_real_)

2023-09-28 Thread Martin Maechler
> Martin Maechler > on Thu, 28 Sep 2023 12:11:27 +0200 writes: > Gregory R Warnes > on Sat, 23 Sep 2023 13:22:35 -0400 writes: > > It sounds like we need to add arguments (with sensible > > defaults) to complex(), Re(), Im(), is.na.complex() etc to > > allow

Re: [Rd] Recent changes to as.complex(NA_real_)

2023-09-28 Thread Martin Maechler
> Gregory R Warnes > on Sat, 23 Sep 2023 13:22:35 -0400 writes: > It sounds like we need to add arguments (with sensible > defaults) to complex(), Re(), Im(), is.na.complex() etc to > allow the user to specify the desired behavior. I don't think I'd like such extra

Re: [Rd] Recent changes to as.complex(NA_real_)

2023-09-25 Thread Hervé Pagès
On 9/25/23 07:05, Martin Maechler wrote: >> Hervé Pagès >> on Sat, 23 Sep 2023 16:52:21 -0700 writes: > > Hi Martin, > > On 9/23/23 06:43, Martin Maechler wrote: > >>> Hervé Pagès > >>> on Fri, 22 Sep 2023 16:55:05 -0700 writes: > >> > The problem is

Re: [Rd] Recent changes to as.complex(NA_real_)

2023-09-25 Thread Martin Maechler
> Hervé Pagès > on Sat, 23 Sep 2023 16:52:21 -0700 writes: > Hi Martin, > On 9/23/23 06:43, Martin Maechler wrote: >>> Hervé Pagès >>> on Fri, 22 Sep 2023 16:55:05 -0700 writes: >> > The problem is that you have things that are >> > **semantically**

Re: [Rd] Recent changes to as.complex(NA_real_)

2023-09-23 Thread Hervé Pagès
Hi Martin, On 9/23/23 06:43, Martin Maechler wrote: >> Hervé Pagès >> on Fri, 22 Sep 2023 16:55:05 -0700 writes: > > The problem is that you have things that are > > **semantically** different but look exactly the same: > > > They look the same: > > >> x > >

Re: [Rd] Recent changes to as.complex(NA_real_)

2023-09-23 Thread Gregory R. Warnes
It sounds like we need to add arguments (with sensible defaults) to complex(), Re(), Im(), is.na.complex() etc to allow the user to specify the desired behavior. -- Change your thoughts and you change the world. --Dr. Norman Vincent Peale > On Sep 23, 2023, at 12:37 PM, Mikael Jagan wrote:

Re: [Rd] Recent changes to as.complex(NA_real_)

2023-09-23 Thread Mikael Jagan
On 2023-09-23 9:43 am, Martin Maechler wrote: Hervé Pagès on Fri, 22 Sep 2023 16:55:05 -0700 writes: > The problem is that you have things that are > **semantically** different but look exactly the same: > They look the same: >> x > [1] NA >> y >

Re: [Rd] Recent changes to as.complex(NA_real_)

2023-09-23 Thread Martin Maechler
> Hervé Pagès > on Fri, 22 Sep 2023 16:55:05 -0700 writes: > The problem is that you have things that are > **semantically** different but look exactly the same: > They look the same: >> x > [1] NA >> y > [1] NA >> z > [1] NA >> is.na(x)

Re: [Rd] Recent changes to as.complex(NA_real_)

2023-09-22 Thread Hervé Pagès
On 9/22/23 16:55, Hervé Pagès wrote: > The problem is that you have things that are **semantically** > different but look exactly the same: > > They look the same: > > > x > [1] NA > > y > [1] NA > > z > [1] NA > > > is.na(x) > [1] TRUE > > is.na(y) > [1] TRUE > > is.na(z) > [1] TRUE > > >

Re: [Rd] Recent changes to as.complex(NA_real_)

2023-09-22 Thread Hervé Pagès
The problem is that you have things that are **semantically** different but look exactly the same: They look the same: > x [1] NA > y [1] NA > z [1] NA > is.na(x) [1] TRUE > is.na(y) [1] TRUE > is.na(z) [1] TRUE > str(x)  cplx NA > str(y)  num NA > str(z)  cplx NA but they are

Re: [Rd] Recent changes to as.complex(NA_real_)

2023-09-22 Thread Spencer Graves
Perhaps I shouldn't comment without having read the entire thread, but I will: I can envision situations where I might want, e.g., 2 from complex(r=2, i=NA_real_). Spencer Graves On 9/22/23 3:43 PM, Duncan Murdoch wrote: Since the result of is.na(x) is the same on each of

Re: [Rd] Recent changes to as.complex(NA_real_)

2023-09-22 Thread Duncan Murdoch
Since the result of is.na(x) is the same on each of those, I don't see a problem. As long as that is consistent, I don't see a problem. You shouldn't be using any other test for NA-ness. You should never be expecting identical() to treat different types as the same (e.g. identical(NA,

Re: [Rd] Recent changes to as.complex(NA_real_)

2023-09-22 Thread Hervé Pagès
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

Re: [Rd] Recent changes to as.complex(NA_real_)

2023-09-22 Thread Mikael Jagan
On 2023-09-22 6:38 am, Martin Maechler wrote: Mikael Jagan on Thu, 21 Sep 2023 00:47:39 -0400 writes: > Revisiting this thread from April: > https://stat.ethz.ch/pipermail/r-devel/2023-April/082545.html > where the decision (not yet backported) was made for >

Re: [Rd] Recent changes to as.complex(NA_real_)

2023-09-22 Thread Martin Maechler
> Mikael Jagan > on Thu, 21 Sep 2023 00:47:39 -0400 writes: > Revisiting this thread from April: > https://stat.ethz.ch/pipermail/r-devel/2023-April/082545.html > where the decision (not yet backported) was made for > as.complex(NA_real_) to give NA_complex_

[Rd] Recent changes to as.complex(NA_real_)

2023-09-20 Thread Mikael Jagan
Revisiting this thread from April: https://stat.ethz.ch/pipermail/r-devel/2023-April/082545.html where the decision (not yet backported) was made for as.complex(NA_real_) to give NA_complex_ instead of complex(r=NA_real_, i=0), to be consistent with help("as.complex") and as.complex(NA) and