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

Vegard Andersen vegard.andersen at ism.uit.no
Fri Mar 18 11:15:34 CET 2005


Hello!

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)
$month
[1] 11
$day
[1] 19
$year
[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

vegard.andersen at ism.uit.no




More information about the R-help mailing list