From h.wickham at gmail.com  Fri Sep 14 23:19:44 2007
From: h.wickham at gmail.com (hadley wickham)
Date: Fri, 14 Sep 2007 16:19:44 -0500
Subject: [Rd] Date vs date
In-Reply-To: <46EAF699.1010000@biostat.ku.dk>
References: <200709141722.l8EHMHF02634@hsrnfs-101.mayo.edu>
	<46EAF699.1010000@biostat.ku.dk>
Message-ID: <f8e6ff050709141419g5637437bkc52dd809120e7760@mail.gmail.com>

> >   3. temp <- as.Date('1990/1/1') - as.date('1953/2/5')
> >      sqrt(temp)
> >      Error in Math.difftime(temp3) : sqrtnot defined for "difftime" objects
> >
> >   Minor bug: no space before the word 'not'
> >   Major: this shouldn't fail.
> >
> >
> Arguably, it should (Is this a difftime object? Which units?).
> I'd advise against numeric operation on difftime objects in general,
> because of the unspecified units. These are always "days" when working
> with Date objects, but with general time objects it is not predictable.
> So I'd recommend sqrt(as.numeric(temp, units="days")).

Why not just always use seconds for difftime objects?  An attribute
could control how it was formatted, but would be independent of the
underlying representation.

Hadley



[Rd] Date vs date
hadley wickham