On Thu, 24 Jul 2008, DCC wrote:
>
> I frequently work with hourly data in GMT format, and ensure that any data
I
> read into R are expressed in GMT through as.POSIXct(mydate, tz =
"GMT").
That makes no sense. POSIXct times are absolute times, not in any
timezone. You can display them in any timezone you like, e.g. by the
format method.
If you have a character representation of a time to convert by as.POSIXct,
you do need to tell R the timezone used in the character representation.
> I am interested in processing air pollution data in GMT where where peaks
in
> emissions (say from road traffic sources) tend to occur at the same LOCAL
> time each day. I am interested in calculating mean concentrations by hour
> of day i.e. a diurnal profile, consisting of 24 hourly means. The profile
> would be clearer if all hours were in local time e.g. the daylight saving
> hours were shifted by +1 hour. This would ensure that the summer and
winter
> profiles match up with those in emissions.
>
> I've looked though the various R documents/forum, but can't seem to
identify
> the easiest approach to this.
>
> Any suggestions?
I think you want
> T <- Sys.time()
> as.POSIXlt(T, tz="Europe/London")$hour
which gives you the hour in the local timezone of Leeds.
>
> Many thanks.
>
> David
> PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
--
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