[R] dates function

Prof Brian Ripley ripley at stats.ox.ac.uk
Wed Jan 28 14:15:44 CET 2004


On Wed, 28 Jan 2004, Massimiliano Tripoli wrote:

> I have problems with years of dates using "chron" package.
> I don't understand why R by this istruction:

It's not R, it is package chron.  R has its own date-time functions.

> > 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 ?

Read the code for convert.dates.  You need to set
option("chron.year.expand") to a suitable function, the prototype being
year.expand and it will be easy to achieve what you want.

This answers your message under the misleading subject `Julian dates' too.

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272860 (secr)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595




More information about the R-help mailing list