From ch|r|com @end|ng |rom goog|e@com  Fri Jul  8 07:17:12 2022
From: ch|r|com @end|ng |rom goog|e@com (Michael Chirico)
Date: Thu, 7 Jul 2022 22:17:12 -0700
Subject: [Rd] stats::poly() stopped working for Date input -- intentional?
Message-ID: <CAD7Bkx85RaBLdhGiUUTgiyRKkBDv=gH=zLVB_+8bGZV=fP3C3g@mail.gmail.com>

SVN#80126 added rep.difftime, which means rep(as.difftime(0,
units="secs")) retains the "datetime" class.

A consequence of this is that stats::poly() no longer accepts
Date/POSIXct input (because poly calls outer() on the de-meaned input,
which rep()):

# works on R 3.6.3 (and probably everything < 4.1.0)
#   but on R 4.1.3 (and probably everything >= 4.1.0):
stats::poly(Sys.Date() - 0:4, 3)
# Error in Ops.difftime(X, Y, ...) : '^' not defined for "difftime" objects

Is this intentional?

If not, a simple patch is to call 'x <- as.double(x)' before de-meaning.



[Rd] stats::poly() stopped working for Date input -- intentional?
Michael Chirico