[R] Julian dates

Gabor Grothendieck ggrothendieck at myway.com
Wed Jan 28 17:20:12 CET 2004


Prof. Riley has already answered this but I thought I would add
a bit more detail.

> # define a function chron.year.expand.0 with a different cutoff.
> # You can choose other cutoffs too but here we have chosen 0.
> chron.year.expand.0 <- function(x) year.expand(x,cut=0)

> # run chron -- we have not yet set the new year expansion
> chron("01/02/29", out.format="year-month-day")
[1] 2029-January-02

> # change the year expansion option to point to the new function
> options(chron.year.expand = "chron.year.expand.0")
> chron("01/02/29", out.format="year-month-day")
[1] 1929-January-02

> # now change it back
> options(chron.year.expand = "year.expand")
> chron("01/02/29", out.format="year-month-day")
[1] 2029-January-02



Date:   Wed, 28 Jan 2004 11:50:11 +0100 
From:   Massimiliano Tripoli <tripoli at med.unibs.it>
To:   <R-help at stat.math.ethz.ch> 
Subject:   [R] Julian dates 

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

Massimiliano




More information about the R-help mailing list