[R] read.spss and time/date information

Uwe Ligges ligges at statistik.uni-dortmund.de
Wed Mar 3 17:39:25 CET 2004


Torsten Hothorn wrote:

> Hi,
> 
> I could not find any information on how `read.spss' deals with date
> information. As an example, I created a file containing two variables,
> one numeric (values = (1, 2)) and one of type "Datum" in SPSS (german
> version with values "11.02.2003" and "03.04.1999" and I get in R:
> 
> SPSSfile = url("http://www.imbe.med.uni-erlangen.de/~hothorn/dates.sav", "rb")
> SPSSdata = readBin(SPSSfile, "numeric", n = 10000)
> writeBin(SPSSdata, con = "dummy.sav")
> library(foreign)
> read.spss("dummy.sav")
> 
> $DUMMY
> [1] 1 2
> 
> $DATE
> [1] 13264300800 13142476800
> 
> attr(,"label.table")
> attr(,"label.table")$DUMMY
> NULL
> 
> attr(,"label.table")$DATE
> NULL
> 
> 
> Could anyone give me a a hint how I can convert 13264300800 to 2003/02/11
> again, please?
> 

Hi Torsten,

Idee:

R> (13264300800-13142476800) / (60*60*24):
[1] 1410

Vom 03.04.1999 bis 11.02.2003: 1410 Tage? Kommt grob hin.
Also ist 13264300800 Anzahl Sekunden seit????
Ist das vielleicht bei SPSS irgendwo dokumentiert?

Bis naechste Woche!

Gruss,
Uwe




More information about the R-help mailing list