How to change the locale of R?

locale, r

Solution

Just had the same problem and found the solution that worked for me on Windows/Linux:

Sys.setlocale("LC_ALL","English")

Problem

I’m using R version 2.15.3 (2013-03-01) on Ubuntu 12.10. The System is in German and so is R. This comes unhandy when searching for error messages. Executing R in xterm this way `$ LANG="C" R` partially solves the issue. Then R displays everything in English. But when loading RStudio this way, the R interpreter is still in German. So I’m looking for a way to change the locale of R in R itself. I found this: How to change language settings in R, but `Sys.setenv(LANG = "en")` does’t work for me: ``` 2+x # Fehler: Objekt 'x' nicht gefunden Sys.setenv(LANG = "en") 2+x # Fehler: Objekt 'x' nicht gefunden ``` I also tried `Sys.setenv(LANG = "en_US.UTF-8")` with no success. Output of `Sys.getlocale()` ``` Sys.getlocale() # [1] "LC_CTYPE=de_DE.UTF-8;LC_NUMERIC=C;LC_TIME=de_DE.UTF-8; # LC_COLLATE=de_DE.UTF-8;LC_MONETARY=de_DE.UTF-8;LC_MESSAGES=de_DE.UTF-8; # LC_PAPER=C;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=de_DE.UTF-8; # LC_IDENTIFICATION=C" ``` (linebrakes added for convenience)

Original source

Related problems