Skip to content
Prev 4138 / 398500 Next

Rounding in date.mdy from library(date)

On Mon, 3 Jan 2000, BXC (Bendix Carstensen) wrote:

            
I think the date package is only intended to handle integers. This is
partly because date.mdy is _not_ a function for converting numbers to
dates, it is a function for converting dates to a printable form.
 
If you look at as.date() the truncation is already done there,

R> as.date(0)
[1] 1Jan60
R> as.date(0.9)
[1] 1Jan60

so a bona fide date object will always have an integer as the time since
1/1/1960. In that sense the workaround is to only use date.mdy on dates,
not on numbers.

I agree that it might be worth extending date to allow times in
addition to dates (in which case it probably would have to have
information on time zones as well).  The tricky part would be parsing
time information in character form, but there is probably GNU code for
this.

	-thomas	


Thomas Lumley
Assistant Professor, Biostatistics
University of Washington, Seattle



-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._