[R] day of the year for chron objects

Agustin Lobo Agustin.Lobo at ictja.csic.es
Fri Jun 8 10:01:13 CEST 2012


Hi!
Is not there an standard R function to retrieve the day of the year
(since 1st Jan of the same year)?
I know I can make my own using julian, but find it weird that having
days(), months() etc doy() does not exist as an standard function.

Also, is the following not a bit inconsistent?

> a <- chron("20100506",format="ymd")
> a
[1] 100506
> years(a)
[1] 2010
Levels: 2010

but instead have to cast to Date to apply julian:
> julian(a)
Error in names(d) : 'd' is missing
> julian(as.Date(a))
[1] 14735
attr(,"origin")
[1] "1970-01-01"

Thanks

Agus

-- 
--
Dr. Agustin Lobo
Institut de Ciencies de la Terra "Jaume Almera" (CSIC)
Lluis Sole Sabaris s/n
08028 Barcelona
Spain
Tel. 34 934095410
Fax. 34 934110012
e-mail Agustin.Lobo at ictja.csic.es
https://sites.google.com/site/aloboaleu/



More information about the R-help mailing list