sessionInfo() fails to correctly detect locale settings
On Fri, 21 Aug 2009, Peter Dalgaard wrote:
Liviu Andronic wrote:
Dear R devels Yesterday I was slightly surprised to notice that R incorrectly detected some of the locale settings. I am not sure whether this is important, but I preferred to drop a message. In the R output below, some entries that should have been "en_GB.UTF-8" are presented as "C". Regards Liviu
R only sets the entries it needs. In particular, you most definitely do not want LC_NUMERIC automatically set to your current locale, as this may cause system I/O to use "," instead of "." in numbers.
It might be worth pointing out that C programs start in the 'C" locale, not the locale of the OS session. So only when a program deliberately set a locale category is the value not 'C". (That's what the standards say: implementations may differ, of course, but apart from some minor difference with MinGW on Windows, I am not aware of any.)
sessionInfo()
R version 2.9.1 (2009-06-26) x86_64-pc-linux-gnu locale:
LC_CTYPE=en_GB.UTF-8;LC_NUMERIC=C;LC_TIME=en_GB.UTF-8;LC_COLLATE=en_GB.UTF-8;LC_MONETARY=C;LC_MESSAGES=en_GB.UTF-8;LC_PAPER=en_GB.UTF-8;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=en_GB.UTF-8;LC_IDENTIFICATION=C
attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] fortunes_1.3-6 relimp_1.0-1 loaded via a namespace (and not attached): [1] tcltk_2.9.1 liviu at debian-liv:~$ locale LANG=en_GB.UTF-8 LC_CTYPE="en_GB.UTF-8" LC_NUMERIC="en_GB.UTF-8" LC_TIME="en_GB.UTF-8" LC_COLLATE="en_GB.UTF-8" LC_MONETARY="en_GB.UTF-8" LC_MESSAGES="en_GB.UTF-8" LC_PAPER="en_GB.UTF-8" LC_NAME="en_GB.UTF-8" LC_ADDRESS="en_GB.UTF-8" LC_TELEPHONE="en_GB.UTF-8" LC_MEASUREMENT="en_GB.UTF-8" LC_IDENTIFICATION="en_GB.UTF-8" LC_ALL=
-- O__ ---- Peter Dalgaard ?ster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907
______________________________________________ R-devel at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
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 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595