[R] R internal clock time discrepancy

Prof Brian Ripley ripley at stats.ox.ac.uk
Sun Jun 18 18:06:42 CEST 2006


On Wed, 14 Jun 2006, toby marthews wrote:

> I'm trying to map some time series data on to dates and
> because I'm using R's "strptime' facility I get an hour's
> break in my time series: my readings for between 1am and
> 2am on 27th March 2005 won't map onto anything (I'm using a
> data logger to record temperature and other things in a
> forest).
> 
> As far as I know, the clock's didn't change on 27th March
> 2005 so why is this happening?

Because R is better informed: UK time changed to BST on 2005-03-27 01:00.
Here is what I get

[1] "2005-03-27 00:00:00 GMT" "2005-03-27 00:30:00 GMT"
[3] "2005-03-27 02:00:00 BST" "2005-03-27 02:30:00 BST"

You seems to be using a broken version of Windows.  Mine gives

> seq(from=start,to=end,by=30*60)
[1] "2005-03-27 00:00:00 GMT Standard Time"
[2] "2005-03-27 00:30:00 GMT Standard Time"
[3] "2005-03-27 02:00:00 GMT Daylight Time"
[4] "2005-03-27 02:30:00 GMT Daylight Time"
[5] "2005-03-27 03:00:00 GMT Daylight Time"
[6] "2005-03-27 03:30:00 GMT Daylight Time"

and the difference is in how an illegal time (end) was interpreted.

>> start=strptime("2005-03-27 00:00","%Y-%m-%d %H:%M")
>> end=strptime("2005-03-27 02:30","%Y-%m-%d %H:%M")
>> seq(from=start,to=end,by=30*60)
> [1] "2005-03-27 00:00:00 GMT Standard Time" "2005-03-27
> 00:30:00 GMT Standard Time" "2005-03-27 02:00:00 GMT
> Standard Time"
> [4] "2005-03-27 02:30:00 GMT Standard Time"

-- 
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-help mailing list