From istazahn at gmail.com  Wed Feb  7 16:04:50 2018
From: istazahn at gmail.com (Ista Zahn)
Date: Wed, 7 Feb 2018 10:04:50 -0500
Subject: [Rd] 
 Possible bug in package installation when R_ICU_LOCALE is set
In-Reply-To: <f83b26e7f5d148deaa3797635e190505@C119S212VM016.msvyvi.vaha.local>
References: <f83b26e7f5d148deaa3797635e190505@C119S212VM016.msvyvi.vaha.local>
Message-ID: <CA+vqiLGFkMoj7fC2QcOSavg4XXML1Ud5zipMW-ynqPh6VjMBSA@mail.gmail.com>

I can reproduce this on Linux, so it is not Windows-specific.

> sessionInfo()
R version 3.4.3 (2017-11-30)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Arch Linux

Matrix products: default
BLAS/LAPACK: /usr/lib/libopenblas_haswellp-r0.2.20.so

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C
LC_TIME=en_US.UTF-8
 [4] LC_COLLATE=en_US.UTF-8     LC_MONETARY=en_US.UTF-8
LC_MESSAGES=en_US.UTF-8
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C
LC_ADDRESS=C
[10] LC_TELEPHONE=C             LC_MEASUREMENT=en_US.UTF-8
LC_IDENTIFICATION=C

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

loaded via a namespace (and not attached):
[1] compiler_3.4.3 rmsfact_0.0.3  tools_3.4.3    cowsay_0.5.0   fortunes_1.5-4


On Wed, Feb 7, 2018 at 8:38 AM, Korpela Mikko (MML)
<mikko.korpela at maanmittauslaitos.fi> wrote:
> On a Windows computer (other platforms not tested), installing a
> package from source may fail if the environment variable R_ICU_LOCALE
> is set, depending on the package and the locale.
>
> For example, after setting R_ICU_LOCALE to "fi_FI",
>
>   install.packages("seriation", type = "source")
>
> (package version 1.2-3) fails with the following error:
>
> ** preparing package for lazy loading
> Error in set_criterion_method("dist", "AR_events", criterion_ar_events,  :
>   could not find function "set_criterion_method"
> Error : unable to load R code in package 'seriation'
>
> Package "Epi" (version 2.24) fails similarly:
>
> ** preparing package for lazy loading
> Error in eval(exprs[i], envir) : object 'Relevel.default' not found
> Error : unable to load R code in package 'Epi'
>
> Whether R_ICU_LOCALE is set before R is launched or during the session
> doesn't matter: installation of these two example packages fails
> either way. If R_ICU_LOCALE is unset, calling
>
>   icuSetCollate(locale = "fi_FI")
>
> is harmless. Browsing through the R manuals, I did not find warnings
> against using R_ICU_LOCALE, or any indication why package installation
> should fail with the variable being set. About the collation order of R
> code files, "Writing R Extensions" says:
>
>> The default is to collate according to the 'C' locale.
>
> I interpret this (and the surrounding text) as a "promise" to package
> developers that no matter what the end user does, the developer should
> be able to rely on the collation order being 'C' unless the developer
> defines another order.
>
>> sessionInfo()
> R version 3.4.3 Patched (2018-02-03 r74231)
> Platform: x86_64-w64-mingw32/x64 (64-bit)
> Running under: Windows 7 x64 (build 7601) Service Pack 1
>
> Matrix products: default
>
> locale:
> [1] LC_COLLATE=Finnish_Finland.1252  LC_CTYPE=Finnish_Finland.1252
> [3] LC_MONETARY=Finnish_Finland.1252 LC_NUMERIC=C
> [5] LC_TIME=Finnish_Finland.1252
>
> attached base packages:
> [1] stats     graphics  grDevices utils     datasets  methods   base
>
> loaded via a namespace (and not attached):
> [1] compiler_3.4.3 tools_3.4.3
>
> --
> Mikko Korpela
> Chief Expert, Valuations
> National Land Survey of Finland
> Opastinsilta 12 C, FI-00520 Helsinki, Finland
> +358 50 462 6082
> www.maanmittauslaitos.fi
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel



[Rd] Possible bug in package installation when R_ICU_LOCALE is set
Ista Zahn