[Rd] ?as.POSIXct (PR#13587)

Prof Brian Ripley ripley at stats.ox.ac.uk
Tue Mar 10 18:42:46 CET 2009


On Tue, 10 Mar 2009, lbraglia at gmail.com wrote:

> Full_Name: Luca Braglia
> Version: 2.8
> OS: Windows
> Submission from: (NULL) (85.18.136.110)
>
>
>> From ?as.POSIXct
>
>     ## SPSS dates (R-help 2006-02-17)
>     z <- c(10485849600, 10477641600, 10561104000, 10562745600)
>     as.Date(as.POSIXct(z, origin="1582-10-14", tz="GMT"))
>                                           ^^
>
> It should be 15 (Gregorian calendar adoption day, when SPSS starts to count
> seconds behind dates) . With 14, I used a .sav dataset imported with read.spss,
> and after as.Date(as.POSIXct()) I got (obviously)
>
> R.date = SPSS.date - 1

Hmm, from the SPSS 'Programming and Data Management' guide:

'Internally, dates and date/times are stored as the number of seconds 
from October 14, 1582, and times are stored as the number of seconds 
from midnight.'

Now, they might just mean the last second of October 14, 1582, but 
that is not how many other people have read this (including those in 
the thread mentioned).

Wikipedia for example describes October 15, 1582 as the first day of 
the Gregorian calendar, which makes 1582-10-14 day zero.

Given that this is an example only, I don't think we should change it 
without quite strong evidence that SPSS's documentation is misleading.


> Bye  (and thank you for givin'us R)
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



More information about the R-devel mailing list