[R] POSIX, timezones and R-ODBC
Cedrick Johnson
cedrick at cedrickjohnson.com
Wed Jul 15 05:41:40 CEST 2009
Howdy-
I recently upgraded to R 2.9.1 and did the updates for all of my packages. A
few of them now *suggest* the TZ variable to be set, which I did:
> Sys.getenv("TZ")
TZ
""
> Sys.setenv(TZ="America/New_York")
> Sys.getenv("TZ")
TZ
"America/New_York"
Next up:
library(RODBC)
library(quantmod)
channel <- odbcConnect("mylovelydb")
> GS = sqlQuery(channel, paste("select Date, o, h, l, c, v from GS ORDER BY
Date ASC"))
Error in as.POSIXlt.character(x, tz, ...) :
character string is not in a standard unambiguous format
In addition: Warning messages:
1: In structure(.Internal(as.POSIXct(x, tz)), class = c("POSIXt",
"POSIXct"), :
unknown timezone 'merica/New_York'
Strange thing: I set up the same thing with R2.9.0 (and as expected, I got
warnings when loading libraries that were built on 2.9.1, but that's ok) --
everything above works with 2.9.0 fine and dandy.
I am wondering how could the TZ, which is "America/New_York" become a
malformed character ('A'). It seems to be either a RODBC issue or something
more sinister under the hood with retrieving the TZ environment variable?
Note, this all works in 2.9.1 if the TZ variable is set to GMT. I can live
with that for the time being as a workaround. To further aid in debugging,
I've attached my sessionInfo output:
> sessionInfo()
R version 2.9.1 (2009-06-26)
i386-pc-mingw32
locale:
LC_COLLATE=English_United States.1252;LC_CTYPE=English_United
States.1252;LC_MONETARY=English_United
States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252
attached base packages:
[1] stats graphics grDevices datasets tcltk utils methods
base
other attached packages:
[1] quantmod_0.3-10 TTR_0.2 Defaults_1.1-1 xts_0.6-6
zoo_1.5-6
[6] RODBC_1.2-6 svSocket_0.9-43 svMisc_0.9-48 TinnR_1.0.3
R2HTML_1.59-1
[11] Hmisc_3.6-0 rcom_2.1-3 rscproxy_1.3-1
loaded via a namespace (and not attached):
[1] cluster_1.12.0 grid_2.9.0 lattice_0.17-25 tools_2.9.0
Any help would be much appreciated.
Regards,
CJ
--
Cedrick W. Johnson
aim) cedrickjcvgr
www.cedrickjohnson.com
More information about the R-help
mailing list