Skip to content
Prev 56465 / 63424 Next

as.Date(Inf) displays as 'NA' but is actually 'Inf'

Richard,

Well others may chime in here, but from a mathematical point of view, the
concept of "infinite days from right now" is well-defined, so it maybe a
"valid" date in that sense, but what day and month it will be (year will be
Inf) are indeterminate/not well defined. Those are rightfully, NA, it
seems?

I mean you could disallow dates to take Inf at all, ever. I don't feel
strongly one way or the other about that, personally. That said, if inf
dates are allowed, its not clear to me that displaying the "Formatted" date
string as NA, even if the value isn't,  is wrong given it can't be
determined for that "date" is. It could be displayed differently, I
suppose, but all the ones I can think of off the top of my head would be
problematic and probably break lots of formatted-dates parsing code out
there in the wild (and in R, I would guess). Things like displaying
"Inf-NA-NA", or just "Inf". Neither of those are going to handle a
read-write round-trip well, I think.

So my personal don't-really-have-a-hat-in-the-ring opinion would be to
either leave it as is, or force as.Date(Inf, bla) to actually be NA.

Best,
~G
On Tue, Mar 5, 2019 at 12:06 PM Richard White <w at rwhite.no> wrote: