[Rd] R CMD check: Locale not set to C?

Tobias Setz tobias.setz at rmetrics.org
Thu Jan 22 16:51:21 CET 2015


Dear All

The "R CMD check" on the "zoo" (1.7-11) package results in an error on my
environment. It can be reduced to the following example:

----------------------------------------------------
> require(zoo)
> read.zoo(system.file("doc", "demo1.txt", package = "zoo"), sep = "|",
format="%d %b %Y")

Error in read.zoo(system.file("doc", "demo1.txt", package = "zoo"), sep =
"|",  :
  index has bad entries at data rows: 14 15 16 17 18 19 20
----------------------------------------------------

I am using the following environment (on Windows 7):

----------------------------------------------------
> sessionInfo()
R version 3.1.2 (2014-10-31)
Platform: x86_64-w64-mingw32/x64 (64-bit)

locale:
[1] LC_COLLATE=German_Switzerland.1252  LC_CTYPE=German_Switzerland.1252
[3] LC_MONETARY=German_Switzerland.1252 LC_NUMERIC=C
[5] LC_TIME=German_Switzerland.1252

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base
----------------------------------------------------

The problem are the locale settings. In the "demo1.txt" the months are
abbreviated in English; while my environment would only accept German
abbreviations. The problem can be solved by setting the time locale:

> Sys.setlocale("LC_TIME", "English")
or
> Sys.setlocale("LC_TIME", "C")


Now; for "R CMD check", the manual
(http://cran.r-project.org/doc/manuals/r-release/R-exts.html) states the
following:

- "R CMD check and R CMD build run R processes with --vanilla..."
So no possibility to set the locales (in contrary to the environment
variables) through an "Rprofile" file...

- "All these tests are run with collation set to the C locale..."
If I set "LC_ALL" or only "LC_TIME" to "C" the example shown at the top
actually works if I run it manually.


However; if I run "R CMD check" I get the ERROR.
Therefore; are the locales really set to "C" for "R CMD check"?
If yes; why would the example above not work?
If no; how could I achieve custom locale settings?

Thanks!
Tobias



------------------------------------------
Tobias Setz
 
Rmetrics Association
tobias.setz at rmetrics.org
www.rmetrics.org



More information about the R-devel mailing list