Re: [R] TimeZone Help - Finding TimeZone codes

From: Prof Brian Ripley <ripley_at_stats.ox.ac.uk>
Date: Mon, 10 Nov 2008 21:23:30 +0000 (GMT)

See ?Sys.timezone, which help.search("timezone") points you to.

On Mon, 10 Nov 2008, stephen sefick wrote:

> I have looked at
> ?as.POSIXct

That also links to Sys.timezone from the 'tz' argument.

> ?POSIXct
> and many of the references that are on those pages.
>
> I am bewildered with timezones. Is there a way to get what would go
> into tz="" for making a function that uses POSIXct to be able to be
> used in all of the timezones in just the united states? This is for
> both windows and mac...

There are rather a lot of timezones in the United States (sic), down to individual counties.

For both Windows (sic) and Mac OS (sic) R uses the Olsen database, and so timezones are best specfied by "America/<city name>" for city names, plus "America/Kentucky/{Louisville,Monticello}"

> this is the function that I am wanting to use it with
>
> library(maptools)
> sunrise.set <- function(lat, long, date, timezone="UTC", num.days=1){
> #this needs to be long lat#
> lat.long <- matrix(c(long, lat), nrow=1)
> day <- as.POSIXct(date, tz=timezone)
> sequence <- seq(from=day, length.out=num.days , by="days")
> sunrise <- sunriset(lat.long, sequence, direction="sunrise",
> POSIXct=TRUE)
> sunset <- sunriset(lat.long, sequence, direction="sunset", POSIXct=TRUE)
> ss <- data.frame(sunrise, sunset)
> ss <- ss[,-c(1,3)]
> colnames(ss)<-c("sunrise", "sunset")
> return(ss)
> }
>
>
>
> thanks in advance,
>
> --
> Stephen Sefick
> Research Scientist
> Southeastern Natural Sciences Academy
>
> Let's not spend our time and resources thinking about things that are
> so little or so large that all they really do for us is puff us up and
> make us feel like gods. We are mammals, and have not exhausted the
> annoying little problems of being mammals.
>
> -K. Mullis
>
> ______________________________________________
> R-help_at_r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> 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

______________________________________________
R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Received on Mon 10 Nov 2008 - 21:25:31 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 14 Nov 2008 - 04:30:25 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive