[R] Julian Dates
Petr Pikal
petr.pikal at precheza.cz
Wed Jan 28 15:57:21 CET 2004
Hallo
On 28 Jan 2004 at 13:13, Massimiliano Tripoli wrote:
> Hi all,
> I have problems with dates format 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
Well, the result probably depends on your system and locale setting.
I would use 4 digit year.
You can use ifelse construction to compute 4 digit years and then you have to
reconstruct your dates vector probably with paste and as.character.
ifelse(as.numeric(substr("01/02/06",7,8))>5,
as.numeric(substr("01/02/06",7,8))+1900,
as.numeric(substr("01/02/06",7,8))+2000)
Cheers
Petr
>
> > dates("01/02/30",out.format="d/m/year")
> [1] 02/Jan/1930
>
>
> reads "29" as 2029
> and "30" as 1930. How could I set the istruction in order to read
> years from "00" to "05" as 2000 to 2005 and "06" to "99" as 1906 to
> 1999 ? Thank you
>
> Dott. Massimiliano Tripoli
> Dipartimento di Scienze Biomediche e Biotecnologie
> Sezione di Statistica Medica e Biometria
> Universitŕ di Brescia
> tel. +39-030-3717467
> fax +39-030-3701157
>
>
>
>
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html
Petr Pikal
petr.pikal at precheza.cz
More information about the R-help
mailing list