How to change the locale of R?

Solution 1:

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

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

Solution 2:

Sys.setlocale("LC_MESSAGES", 'en_GB.UTF-8')
Sys.setenv(LANG = "en_US.UTF-8")

This 2 worked for me. No more polish error messages in eclipse R. Though I think only the 2nd had effect. Thanks

edit: although I have to execute those every time i restart R environment.

Solution 3:

If you want to do this temporarily, you can try starting R from the command line preceded by setting the language in-line:

# start R with LANGUAGE set to Mandarin
LANGUAGE=zh_CN.UTF-8 R --no-save
# do R stuff
q()
# any LANGUAGE set in your env will be unaffected afterwards
env | grep LANGUAGE

Solution 4:

In Ubuntu (14.04) this is the solution that worked for me:

Edit the .Renviron file in your home directory and add this line:

LANGUAGE="en_US.utf8"
# for R with British accent use en_GB.utf8

Then restart R.