[R] How to convert SPSS date data to dates?

Peter Dalgaard p.dalgaard at biostat.ku.dk
Thu Feb 16 18:42:27 CET 2006


"Jonathan Williams" <jonathan.williams at pharmacology.oxford.ac.uk> writes:

> Dear R Helpers,
> 
> I have imported an SPSS file that contains date data.
> The data appear in R in a numeric format, as follows:
> 
> 10485849600 10477641600 10561104000 10562745600 etc.
> 
> I'd be extremely grateful if someone could tell me
> how to make these numbers into comprehensible dates!

> c(10485849600,10477641600,10561104000,10562745600)+ISOdate(1582,10,14)
[1] "1915-01-26 13:00:00 CET" "1914-10-23 13:00:00 CET"
[3] "1917-06-15 13:00:00 CET" "1917-07-04 13:00:00 CET"

Does this look right? (If you don't want the times, use as.Date).

BTW: There's a strange asymmetry:

> ISOdate(1582,10,14)+
> c(10485849600,10477641600,10561104000,10562745600)
[1] "1915-01-26 12:00:00 GMT" "1914-10-23 12:00:00 GMT"
[3] "1917-06-15 12:00:00 GMT" "1917-07-04 12:00:00 GMT"

(have we seen this before?).

-- 
   O__  ---- Peter Dalgaard             Øster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark          Ph:  (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)                  FAX: (+45) 35327907




More information about the R-help mailing list