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

From: Prof Brian Ripley <ripley_at_stats.ox.ac.uk>
Date: Fri 17 Feb 2006 - 05:02:55 EST

On Thu, 16 Feb 2006, Peter Dalgaard wrote:

> "Jonathan Williams" <jonathan.williams@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?).

Yes, and the second is correct. Timezones are taken from the lhs in +.POSIXt. (That could probably now safely be changed.)

-- 
Brian D. Ripley,                  ripley@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

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Received on Fri Feb 17 05:17:05 2006

This archive was generated by hypermail 2.1.8 : Mon 20 Feb 2006 - 14:08:32 EST