[R] problem in as.date

utkarshsinghal utkarsh.singhal at global-analytics.com
Thu Apr 30 08:16:56 CEST 2009


I never understood that why is the value returned by as.date function in 
the library(survival) never matches with the description given in the 
help file:
Following is the extract from ?as.date

Description:
Converts any of the following character forms to a Julian date:
     8/31/56, 8-31-1956, 31 8 56, 083156, 31Aug56, or August 31 1956.

Usage:
     as.date(x, order = "mdy", ...)

Value:
     For each date, the number of days between it and January 1, 1960.
     The date will be missing if the string is not interpretable.

But here is what happens when you actually use it:

 > as.date(c("1jan1960"))
[1] 1Jan60

Can somebody explain this?
Also please suggest me the best function in R to convert from 
as.Date("2009-08-13") to Julian and vice versa.

Regards
Utkarsh




More information about the R-help mailing list