Re: [Rd] 1954 from NA

2021-05-23 Thread Greg Minshall
+1 Avi Gross via R-devel wrote: > Arguably, R was not developed to satisfy some needs in the way intended. > > When I have had to work with datasets from some of the social sciences I have > had to adapt to subtleties in how they did things with software like SPSS in > which an NA was done us

Re: [Rd] 1954 from NA

2021-05-23 Thread Avi Gross via R-devel
Arguably, R was not developed to satisfy some needs in the way intended. When I have had to work with datasets from some of the social sciences I have had to adapt to subtleties in how they did things with software like SPSS in which an NA was done using an out of bounds marker like 999 or "." o

Re: [Rd] 1954 from NA

2021-05-23 Thread Tomas Kalibera
On 5/23/21 8:04 PM, Adrian Dușa wrote: > Dear Tomas, > > I understand that perfectly, but that is fine. > The payload is not going to be used in any computations anyways, it is > strictly an information carrier that differentiates between different > types of (tagged) NA values. Good, but unfor

Re: [Rd] 1954 from NA

2021-05-23 Thread Adrian Dușa
Dear Tomas, I understand that perfectly, but that is fine. The payload is not going to be used in any computations anyways, it is strictly an information carrier that differentiates between different types of (tagged) NA values. Having only one NA value in R is extremely limiting for the social s

Re: [Rd] 1954 from NA

2021-05-23 Thread Tomas Kalibera
TLDR: tagging R NAs is not possible. External software should not depend on how R currently implements NA, this may change at any time. Tagging of NA is not supported in R (if it were, it would have been documented). It would not be possible to implement such tagging reliably with the current

Re: [Rd] 1954 from NA

2021-05-23 Thread brodie gaslam via R-devel
> On Sunday, May 23, 2021, 10:45:22 AM EDT, Adrian Dușa > wrote: > > On Sun, May 23, 2021 at 4:33 PM brodie gaslam via R-devel > wrote: > > I should add, I don't know that you can rely on this > > particular encoding of R's NA.  If I were trying to restore > > an NA from some external format, I

Re: [Rd] 1954 from NA

2021-05-23 Thread Adrian Dușa
On Sun, May 23, 2021 at 4:33 PM brodie gaslam via R-devel < r-devel@r-project.org> wrote: > I should add, I don't know that you can rely on this > particular encoding of R's NA. If I were trying to restore > an NA from some external format, I would just generate an > R NA via e.g NA_real_ in the

Re: [Rd] 1954 from NA

2021-05-23 Thread Mark van der Loo
I wrote about this once over here: http://www.markvanderloo.eu/yaRb/2012/07/08/representation-of-numerical-nas-in-r-and-the-1954-enigma/ -M Op zo 23 mei 2021 15:33 schreef brodie gaslam via R-devel < r-devel@r-project.org>: > I should add, I don't know that you can rely on this > particular en

Re: [Rd] 1954 from NA

2021-05-23 Thread brodie gaslam via R-devel
I should add, I don't know that you can rely on this particular encoding of R's NA.  If I were trying to restore an NA from some external format, I would just generate an R NA via e.g NA_real_ in the R session I'm restoring the external data into, and not try to hand assemble one. Best, B. On

Re: [Rd] 1954 from NA

2021-05-23 Thread brodie gaslam via R-devel
This is because the NA in question is NA_real_, which is encoded in double precision IEEE-754, which uses 64 bits.  The "1954" is just part of the NA.  The NA must also conform to the NaN encoding for double precision numbers, which requires that the "beginning" portion of the number be "0x7ff0" (w

[Rd] 1954 from NA

2021-05-23 Thread Adrian Dușa
Dear R devs, I am probably missing something obvious, but still trying to understand why the 1954 from the definition of an NA has to fill 32 bits when it normally doesn't need more than 16. Wouldn't the code below achieve exactly the same thing? typedef union { double value; unsigned sh