[Rd] [External] Re: 1954 from NA

Avi Gross @v|gro@@ @end|ng |rom ver|zon@net
Wed May 26 04:03:42 CEST 2021


Greg,

I am curious what they suggest you use multiple NaN values for. Or, is it simply like how text messages on your phone started because standard size packets were bigger than what some uses required so they piggy-backed messages on the "empty" space.

If by NaN you include the various flavors of NA such as NA_logical_ and NA_complex_ I have sometimes wondered if they are slightly different bitstreams or all the same but interpreted by programs as being the right kind for their context. Sounds like maybe they are different and there is one for pretty much each basic type except perhaps raw.

But if you add more, in that case, will it be seen as the right NA for the environment it is in? Heck, if R adds yet another basic type (like a quaternion) or a nibble, could they use the same bits you took without asking for your application?

It does sound like some suggest you use a method with existing abilities and tightly control that all functions used to manipulate the data will behave and preserve those attributes. I am not so sure the clients using it will obey. I have seen plenty of people say use some tidyverse functions for various purposes then use something more base-R like complete.cases() or rbind() that may, but also may not, preserve what they want. And once lost, ...

Now, of course, you could write wrapper functions that will take the data, copy the attributes, allow whatever changes, and carefully put them back before returning. This may not be trivial though if you want to do something like delete lots of rows as you might need to first identify what rows will be kept, then adjust the vector of attributes accordingly before returning it. Sorting is another such annoyance. Many things do conversions such as making copies or converting a copy to a factor, that may mess things up. If it has already been done and people have experience, great. If not, good luck.

-----Original Message-----
From: Gregory Warnes <greg using warnes.net> 
Sent: Tuesday, May 25, 2021 9:13 PM
To: Avi Gross <avigross using verizon.net>
Cc: r-devel <R-devel using r-project.org>
Subject: Re: [Rd] [External] Re: 1954 from NA

As a side note, for floating point values, the IEEE 754 standard provides for a large set of NaN values, making it possible to have multiple types of NAs for floating point values...



More information about the R-devel mailing list