[R] "options" in R

David Winsemius dwinsemius at comcast.net
Wed Oct 3 22:05:17 CEST 2012


On Oct 3, 2012, at 11:00 AM, Santosh wrote:

> Dear Rxperts,
> Was wondering if there is any function in R similar to
> options("time.zone"): found in S-Plus that can help in looking at the
> default timezone settings..

Many of us have no way to understand questions based on analogies with S. Are you asking how to see the current TZ? 

> attr(as.POSIXlt(Sys.time()), "tzone"  )
[1] ""    "PST" "PDT"


Your timezone is handled by your OS (and the printed output is handled by print.POSIXct, which has options for converting to other TZs).  From the timezones  help page:

"Note that except on Windows, the operation of time zones is an OS service, and even on Windows a third-party database is used and can be updated (see the section on ‘Time zone names’)."

Or are you asking where to find the range of possible values?

This is the first example in the help page for

 ?timezones

zfile <- "/usr/share/zoneinfo/zone.tab"
tzones <- read.delim(tzfile, row.names = NULL, header = FALSE,
    col.names = c("country", "coords", "name", "comments"),
    as.is = TRUE, fill = TRUE, comment.char = "#")
str(tzones$name)
 chr [1:410] "Europe/Andorra" "Asia/Dubai" "Asia/Kabul" "America/Antigua" "America/Anguilla" ...

-- 
David Winsemius, MD
Alameda, CA, USA




More information about the R-help mailing list