[R] Julian Dates

Ko-Kang Kevin Wang kwan022 at stat.auckland.ac.nz
Mon Dec 15 21:55:39 CET 2003


Hi,

I'm a bit confused how julian() works.  If I understand right, it returns 
the number of days since the origin. 

I have a vector:
> SLDATX[1:10]
 [1] "1986-01-06" "1986-01-17" "1986-02-02" "1986-02-04"
 [5] "1986-02-04" "1986-02-21" "1986-03-06" "1986-03-25"
 [9] "1986-04-06" "1986-04-10"

And when I did:
> TIMESOLD <- as.numeric(julian(as.POSIXlt(SLDATX),
+                               origin = as.POSIXct("1986-01-01", "")))

I got:
> TIMESOLD[1:10]
 [1]  5.00000 16.00000 32.00000 34.00000 34.00000 51.00000
 [7] 64.04167 83.04167 95.04167 99.04167


THe first 6 values from TIMESOLD is obvious, however I'm not sure why I 
got decimals from the 7th value, as my input vector does not have any 
specific "times" after the dates.

Any insights would be greatly appreciated...;-D

-- 
Cheers,

Kevin

---------------------------------------------------------------
"Try not.  Do, do!  Or do not.  There is no try"
   Jedi Master Yoda

----
Ko-Kang Kevin Wang, MSc
SLC STATS 10x Workshop Coordinator
University of Auckland
New Zealand
Homepage: http://www.stat.auckland.ac.nz/~kwan022
Ph: 373-7599  x88475




More information about the R-help mailing list