[R] Date conversion problem using "as.Date"

From: Vegard Andersen <vegard.andersen_at_ism.uit.no>
Date: Fri 18 Mar 2005 - 21:15:34 EST


My problem is that the Julian date "behind" my dates seems to be wrong. I will examplify my problem.

t1 <- "1998-11-20"
t2 <- as.Date(t1)
# Here t2 is correctly "1998-11-20", but date.mdy(t2)

[1] 11

[1] 19

[1] 1988

And indeed, if I write: fix(t2) then I get : structure(10550, class = "Date"). So the Julian date is 10550, which is "1988-11-19", not the correct "1998-11-20"

If I instead of "as.Date" use "as.date", then things work ok. But I have not found out how to instruct "as.date" to handle dates from the 21st century.

I hope that someone can help me, thanks in advance!

Best regards,
Vegard Andersen
Institute of Community Medicine
University of Tromso
Tromso, Norway


R-help@stat.math.ethz.ch mailing list
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Received on Fri Mar 18 21:23:26 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:30:51 EST