[R] Help with 'get.hist.quote' on tseries

Kurt Hornik Kurt.Hornik at ci.tuwien.ac.at
Mon Oct 29 13:08:48 CET 2001


>>>>> Ko-Kang Wang writes:

> Well I have the same problem but ONLY WITH trying to get ibm.  In
> other words all other examples in the ?get.hist.quote are fine:

> I am running R 1.3.1 on Windows ME.

I am confused.  Why does the ibm example fail and the others not?

In general, I think the reported problems are due to Windows locale
peculiarities.  The code in get.hist.quote() does

        lct <- Sys.getlocale("LC_TIME")
        Sys.setlocale("LC_TIME", "C")
        on.exit(Sys.setlocale("LC_TIME", lct))
        dat <- gsub(" ", "0", as.character(x[, 1]))
        dat <- as.POSIXct(strptime(dat, "%d-%b-%y"), tz = "GMT")

and I think this should be safe to ensure a C locale when reading in the
quotes.  We have to do this as entries are of the form

	26-Oct-01,110,112.10,109.62,111.16,10142500

If relying on strptime correctly parsing C locale month name abbrevs
cannot be assumed, we could fall back to hard-wiring month names.

The problem reported comes in fromchar() inside as.POSIXlt so it would
be interesting to see what strptime(dat, "%d-%b-%y") gives on platforms
where the problem occurs.

-k
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list