[R] Julian dates

(Ted Harding) Ted.Harding at nessie.mcc.ac.uk
Wed Jan 28 17:38:37 CET 2004


On 28-Jan-04 Massimiliano Tripoli wrote:
> Hi all,
> I have problems with years of dates using "chron" package.
> I don't understand why R by this istruction:
>> dates("01/02/29",out.format="d/m/year")
> [1] 02/Jan/2029
> 
>> dates("01/02/30",out.format="d/m/year")
> [1] 02/Jan/1930
> 
> reads "29" as 2029
> and "30" as 1930. How could I change to read "00" to "05" like 2000 to
> 2005 and "06" to "99" like 1906 to 1999 ?

I'm puzzled by the above:

> dates("01/02/29",out.format="d/m/year")
[1] 02/Jan/2029
> dates("01/02/30",out.format="d/m/year")
[1] 02/Jan/1930

so chron apparently acts as though time began at 01/01/1930.

However:

> ?chron
-->
 origin.: a vector specifying the date with respect to which Julian
          dates are computed.  Default is 'c(month = 1, day = 1,
          year = 1970)'

(which is the orthodox origin of time according to Unix) and, indeed,

> origin(dates("01/02/29",out.format="d/m/year"))
month   day  year 
    1     1  1970 

So why does Massimiliano's example behave as though the origin
were 01/01/1930?

Best wishes,
Ted.


--------------------------------------------------------------------
E-Mail: (Ted Harding) <Ted.Harding at nessie.mcc.ac.uk>
Fax-to-email: +44 (0)870 167 1972
Date: 28-Jan-04                                       Time: 16:38:37
------------------------------ XFMail ------------------------------




More information about the R-help mailing list