[R] Weird Excel Time Format

Hasan Diwan hasan.diwan at gmail.com
Tue Nov 29 19:15:37 CET 2011


On 29 November 2011 09:32, Prof Brian Ripley <ripley at stats.ox.ac.uk> wrote:
> If all else fails, read the help page.  There are examples on ?as.Date of
> reading Excel dates.
I did, it seems there is either (a) a problem with my code, or (b) a
problem with the documentation. See below:
> rawtimeColumn
[1] 39406.577662037  39406.5862847222 39406.5923611111
39406.5972800926 39406.6038194444 39406.6445601852 39406.6478587963
39406.6619212963 39406.6634259259 39406.6643518519
[11] 39406.665162037  39406.6659143519 39406.6663194444
39406.668287037  39406.6702546296 39406.6722106481 39406.6728587963
39406.6731481481 39406.6049768518 39406.5854166667
[21] 39406.5895833333 39406.5923611111 39406.59375
39406.5972222222 39406.6013888889 39406.60625      39406.6194444444
39406.6201388889 39406.6215277778 14:5730
[31] 39406.6263888889 39406.6277777778 39406.6298611111
39406.6298611111 39406.6340277778 39406.6368055556 39406.6409722222
> as.Date(as.numeric(rawtimeColumn), origin='1904-01-01') # per as.Date() help
[1] "1904-01-04" "1904-01-07" "1904-01-13" "1904-01-19" "1904-01-23"
"1904-02-18" "1904-02-21" "1904-02-29" "1904-03-01" "1904-03-02"
"1904-03-03" "1904-03-04" "1904-03-05" "1904-03-06"
[15] "1904-03-07" "1904-03-08" "1904-03-09" "1904-03-10" "1904-01-25"
"1904-01-06" "1904-01-11" "1904-01-13" "1904-01-16" "1904-01-18"
"1904-01-20" "1904-01-26" "1904-01-31" "1904-02-01"
[29] "1904-02-03" "1904-01-02" "1904-02-06" "1904-02-07" "1904-02-10"
"1904-02-10" "1904-02-12" "1904-02-13" "1904-02-15"

These readings were taken at the 23rd of November in 2011.
>
> But I don't believe the time you give. (0.577662037 is just before
> 13:51:50).

It was contrived, so probably was wrong and I should have made that explicit.
-- 
Sent from my mobile device
Envoyait de mon portable



More information about the R-help mailing list