[R] chron and locales

ripley@stats.ox.ac.uk ripley at stats.ox.ac.uk
Thu Nov 14 20:44:54 CET 2002

On Thu, 14 Nov 2002, Detlef Steuer wrote:

> (R-1.6.0 and chron 2.2, linux)

This appears to have nothing to do with chron!

> I have to work with date/time values from another LOCALE
> on my machine. My normal locale is "de DE at euro" and
> the data I have to handle use AM/PM specifications for the times.
> dstring <- "Nov 12 2001  4:31PM"
> The problem now is, that
> strptime(dstring, "%b %d %Y %I:%M%p")
> [1] "2001-11-12 04:31:00"
> just ignores my times coming from another locale.
> I have a workaroud (kind of) in setting my LANG enviroment to C
> before starting R, but I hope for a better, more portable solution.
> Any hints?

That's what Sys.setlocale is for, as illustrated on the help page
for strptime (!)

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 272860 (secr)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

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