[R] removing daylight savings in R

Prof Brian Ripley ripley at stats.ox.ac.uk
Fri Feb 27 08:42:47 CET 2009


What do you mean by 'standard time'? If you mean UTC, set TZ=UTC. 
For anything else, see ?Sys.timezone (which explains the use of TZ).

I am guessing that you are storing times in "POSIXct" objects (you do 
not say): they are in UTC.  Have you any evidence that 'datetimes are 
getting converted to daylight savings times'?  More likely they are 
getting *printed* in your local timezone, because that is the 
documented default behaviour.  But you can change it (see 
?format.POSIXct).

You are attributing self-will to R in 'an ORACLE database that R is 
importing data in from': it is merely following instructions.  We 
don't have those instructions and there is no sign of a package that 
could do this in your sessionInfo (R itself has no such facilities). 
If the Oracle database is not in your local timezone (which seems to 
be the case) you will need to tell the import facilty what time it is 
in.  If the (non-R) import facility does this right, the datetimes 
will be marked as being in UTC (or whatever), and most of the time 
printed as such (but I would always do so explicitly).

The difference betwee 2.6.2 and later versions is that lots of bugs in 
the way Windows handles timezones were fixed, so it sounds as if you 
have been relying on a Windows bug.

On Fri, 27 Feb 2009, Rhiannon Marchant wrote:

>
>   Hi all,
>   I've been having some trouble with times in regards to daylight savings in R
>   version 2.8.1.  I have an ORACLE database that R is importing data in from,
>   for the 2am and 2:30am time intervals for the dates that daylight savings
>   starts the times are getting read as NA values into R. I'm also finding that
>   if  I  open a R workspace from version 6.2.2,the datetimes are getting
>   converted to daylight savings times.  The times are a cruical part of my
>   analysis and need to stay in standard time. I would like to be using a newer
>   version of R than I am currently using (2.6.2) so that I can make use of the
>   newer packages that are available, however with this problem of the time
>   conversions I am unable to do this. Is anyone able to help with to set up
>   R2.8.1 to use standard time instead of daylight savings times?

[...]

-- 
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