[R] Help with setting locale

David Winsemius dw|n@em|u@ @end|ng |rom comc@@t@net
Fri Sep 14 17:44:56 CEST 2018


> On Sep 14, 2018, at 1:02 AM, Kim Titcombe <ktitcombe02 using gmail.com> wrote:
> 
> *Query or Set Aspects of the Locale*
> 
> I have an issue with setting LOCALE in installation (new  installation on
> new computer but have installed and used R before).
> 
> I am based in Switzerland but work in English (Windows in English), hence
> want English as default.
> 
> Console contains following message:
> 
> # During startup - Warning message:
> 
> # Setting LC_CTYPE= failed
> 
> -------------------------------------------------
> 
> Solutions I tried found on “help” and in R manual as follows….
> 
> # Sys.getlocale(category = “LC_ALL”)
> 
> 1]
> "LC_COLLATE=English_Switzerland.65001;LC_CTYPE=C;LC_MONETARY=English_Switzerland.65001;LC_NUMERIC=C;LC_TIME=English_Switzerland.65001"
> 
> # Sys.setlocale(category=”LC_ALL”, locale = “ “)
> 
> or
> 
> # Sys.setlocale(category=”LC_ALL”, local=”Switzerland.65001”)
> 
> Output
> 
> # OS reports request to set locale to "Switzerland.65001" cannot be honoured
> 
> Tried various commands specific for 'LC_CTYPE' (as this is where
> installation failed) for language string such as
> 
> # Sys.setlocale("LC_CTYPE","en-GB")

You may get better results with an underscore rather than a dash.

Try: 

Sys.setlocale("LC_CTYPE","en_GB")



On my machine you can get the acceptable locale strings with:

locales <- system("locale -a", intern = TRUE)
locales[ grep("GB",locales) ]  # Just the GB strings
[1] "en_GB"            "en_GB.ISO8859-1"  "en_GB.ISO8859-15" "en_GB.US-ASCII"   "en_GB.UTF-8"      "zh_CN.GB18030"    "zh_CN.GB2312"    
[8] "zh_CN.GBK"       



> 
> Output:
> 
> In Sys.setlocale("LC_CTYPE", "en-GB") :
> 
>  OS reports request to set locale to "en-GB" cannot be honoured
> 
> Would anyone have any further suggestions for correct command.
> 
> With thanks
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

David Winsemius
Alameda, CA, USA

'Any technology distinguishable from magic is insufficiently advanced.'   -Gehm's Corollary to Clarke's Third Law




More information about the R-help mailing list