Skip to content
Prev 163722 / 398506 Next

date operations

On Wed, 2008-12-03 at 14:13 -0500, Gabor Grothendieck wrote:
<snip />
Yes, sorry, got distracted with dinner...
I guess something like this is happening:
[1] "2009-02-15"

Although internally, `+.Date` deals with objects of class "difftime" for
either date or x. So technically the help for ?`+.Date` is at odds with
the code; although there is a degree of ambiguity in what a 'date
object' is?
But you are doing method dispatch yourself (by hand) in the first case
and allowing `+` to deal with it in the latter. The warning is not
coming from `+.Date`().

This looks like an infelicity in non-standard method dispatch that takes
place within `+`, a primitive function. It would be nice if `+` didn't
raise warnings about potential incompatible classes, but it can't know
in advance what methods users might write for it.
Well, I read it as not converting his "Date"s to numerics (I converted a
"difftime"). But that is splitting hairs ;-)

The OP can use `+.Date` directly as you suggest, or ignore the warnings
as they are harmless, or coerce the difftime object to numeric as I
suggested. It makes no odds in these cases.

I guess the main point for the OP is to realise why the warning is there
and determine if it is OK to ignore.

G