My error messages are displayed in French. How can I change my system language setting so the error messages will be displayed in English?
18 Answers
You can set this using the Sys.setenv()
function. My R session defaults to English, so I'll set it to French and then back again:
> Sys.setenv(LANG = "fr")
> 2 + x
Erreur : objet 'x' introuvable
> Sys.setenv(LANG = "en")
> 2 + x
Error: object 'x' not found
A list of the abbreviations can be found here.
Sys.getenv()
gives you a list of all the environment variables that are set.

- 67,710
- 18
- 144
- 161
-
23This changes the Lang temporarily(during the R session). To change it once for all , you need to add the environment variable to your system, and relaunch RStudio so thistake effect. – agstudy Dec 01 '12 at 15:51
-
This solution works well but when I reopen R it returns to my locale (which is Italian). – SabDeM May 14 '15 at 23:26
-
3@SabDeM - yes, indeed. Heed the note of agstudy above and set the environment variable: http://stat.ethz.ch/R-manual/R-devel/library/base/html/EnvVar.html – Chase May 15 '15 at 04:22
In the case of RStudio for Windows I succeeded in changing the language following the instructions found in R for Windows FAQ, in particular I wrote:
language = EN
inside the file Rconsole
(in my installation it is C:\Program Files\R\R-2.15.2\etc\Rconsole
); this works also for the command Rscript
.
For example you can locate the Rconsole
file with this two commands from a command prompt:
cd \
dir Rconsole /s
The first one make the root as the current directory, the second one looks for the Rconsole
file.
In the following screenshot you have that Rconsole
file is in the folder C:\Program Files\R\R-3.4.1\etc
.
You may have more than one location, in that case you may edit all the Rconsole
files.
After that you can open the Rconsole
file with your favorite editor and look for the line language =
and then append EN
at the end of that line.
In the following screenshot the interesting line is the number 70 and you have to append EN
at the end of it.

- 18,047
- 15
- 98
- 153
-
1Does not work for me. Changing the file and setting the language to EN has no effect on the language of error messages. I can see that it would be logical for this to work, but I assume that in the meantime Windows has several other language configuration directives (maybe the system's language, the system's keyboard layout) that interact in complex and intransparent ways. – 0range Mar 31 '20 at 13:27
-
@0range did you try `cd \ ` and `dir Rconsole /s` in order to look for multiple files? – Alessandro Jacopson Apr 01 '20 at 06:50
For mac users, I found this on the R for Mac FAQ
If you use a non-standard setup (e.g. different language than formats), you can override the auto-detection performed by setting `force.LANG' defaults setting, such as for example
defaults write org.R-project.R force.LANG en_US.UTF-8
when run in Terminal it will enforce US-english setting regardless of the system setting. If you don't know what Terminal is you can use this R command instead:
system("defaults write org.R-project.R force.LANG en_US.UTF-8")
but do not forget to quit R and start R.app again afterwards. Please note that you must always use `.UTF-8' version of the locale, otherwise R.app will not work properly.
This helped me to change my console language from Chinese to English.

- 261
- 3
- 4
This works from command line :
$ export LANG=en_US.UTF-8
None of the other answers above worked for me

- 2,194
- 1
- 19
- 34
-
if one runs R directly from the command line, the answer above can be written inside the `.bash_profile` file (in Mac OS). Then, just type `source .bash_profile` to make the change effective in the window. _obs_: assuming `pwd` is `~`, i.e. home directory. – Mattia Paterna Jan 30 '18 at 13:57
If you use Ubuntu you will set
LANGUAGE=en
in /etc/R/Renviron.site
.

- 3,826
- 4
- 18
- 37

- 406
- 5
- 15
-
1This is true but not very helpful since you have to edit that file from the terminal. For noobs like me googling this here is how: type `sudo nano /etc/R/Renviron.site` into the terminal, followed by your password when the terminal asks you for it. Then you can edit that file right in the terminal. Add the line linellobocki mentions, then push `ctrl + x` to exit. Then type `y` to confirm that you want to save changes and hit enter to confirm the name and directory of the file. – Jakob Jun 15 '18 at 02:52
-
How can I do this in anaconda environment? You must know when using a supercomputer it usual to install R and dependencies locally, and anaconda is good for that, but now I need to set the LANGUAGE to 'en' and IDK where it is this Renviron.site file – Sergio Jan 24 '19 at 02:25
-
You may also want to be aware of the difference between, for example, Sys.setenv(LANG = "ru")
and Sys.setlocale(locale = "ru_RU.utf8")
.
> Sys.setlocale(locale = "ru_RU.utf8")
[1] "LC_CTYPE=ru_RU.utf8;LC_NUMERIC=C;LC_TIME=ru_RU.utf8;LC_COLLATE=ru_RU.utf8;LC_MONETARY=ru_RU.utf8;LC_MESSAGES=en_IE.utf8;LC_PAPER=en_IE.utf8;LC_NAME=en_IE.utf8;LC_ADDRESS=en_IE.utf8;LC_TELEPHONE=en_IE.utf8;LC_MEASUREMENT=en_IE.utf8;LC_IDENTIFICATION=en_IE.utf8"
If you are interested in changing the behaviour of functions that refer to one of these elements (e.g strptime
to extract dates), you should use Sys.setlocale()
.
See ?Sys.setlocale
for more details.
In order to see all available languages on a linux system, you can run
system("locale -a", intern = TRUE)

- 3,043
- 21
- 24
To permanently make it works, in both R and Rstudio (with Win 10), one way to do this is to run the script every time automatically in the background initially.
No more changing the system language that influence the windows. No more R only but fail in Rstudio. No more run a script every time manually. No more admin right but fail. No more short-cut setting but fail.
Step 1. Use your system search, to find the file named "Rprofile"
My response is
C:\Program Files\R\R-4.0.5\library\base\R
C:\Program Files\R\R-4.0.5\etc
Step 2. Edit C:\Program Files\R\R-4.0.5\library\base\R\Rprofile
The content:
- This is the system Rprofile file. It is always run on startup.
- Additional commands can be placed in site or user Rprofile files
- (see ?Rprofile) ... and so on.
Step 3. Add Sys.setenv(LANGUAGE="en") at the end of the scrip
local({
Sys.setenv(LANGUAGE="en")
})
P.S. If you encounter the issue of authorization/saving, move this file to desktop and replace the original file after editing.
-
I am confused. Other answers propose setting "LANG", others "LANGUAGE". Why? – R Yoda Jul 09 '21 at 14:27
-
Does not matter in fact. The only question is if this method(both "LANG"/"LANGUAGE") works for you. Have fun in the data science. – Ivan C. Jul 10 '21 at 16:13
-
type this first: system("defaults write org.R-project.R force.LANG en_US.UTF-8") then you will get a index number(in my case is 127)
then type: Sys.setenv(LANG = "en") then type the number and ENTER 127

- 51
- 1
- 1
For me worked:
Sys.setlocale("LC_MESSAGES", "en_US.utf8")
Testing:
> Sys.setlocale("LC_MESSAGES", "en_US.utf8")
[1] "en_US.utf8"
> x[3]
Error: object 'x' not found
Also working to get english messages:
Sys.setlocale("LC_MESSAGES", "C")
To reset to german messages I used
Sys.setlocale("LC_MESSAGES", "de_DE.utf8")
Here is the start of my sessionInfo
:
> sessionInfo()
R version 3.4.1 (2017-06-30)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 16.04.2 LTS

- 12,469
- 11
- 37
- 42
-
Note: This does not work on Windows (see help for `Sys.setlocale`: "Some systems (not Windows) will also support LC_MESSAGES...") – R Yoda Aug 25 '21 at 17:06
A simple solution would be setting export Lang=C in your bash script. I had a similar issue where the default language was german so it reverted back to english.

- 41
- 2
-
-
This is a good solution. I'm running R using anaconda and your solution worked for me. – Sergio Jan 24 '19 at 02:33
If you want to change R's language in terminal to English forever, this works fine for me in macOS:
Open terminal.app, and say:
touch .bash_profile
Then say:
open -a TextEdit.app .bash_profile
These two commands will help you open ".bash_profile" file in TextEdit.
Add this to ".bash_profile" file:
export LANG=en_US.UTF-8
Then save the file, reopen terminal and type R
, you will find it's language has changed to english.
If you want language come back to it's original, just simply add a #
before export LANG=en_US.UTF-8
.

- 31
- 1
The only thing that worked for me was uninstalling R entirely (make sure to remove it from the Programs files as well), and install it, but unselect Message Translations during the installation process. When I installed R, and subsequently RCmdr, it finally came up in English.

- 21
- 1
In Ubuntu 14.04 LTS I had to remove the #
from the comment #LANGUAGE=EN
.
All other options din not work for me.

- 9,956
- 2
- 31
- 55
Change your current regional format to a different regional format in region settings on time&language settings in Windows by clicking on your time/date in lower right corner > adjust time/date > Region > change regional format to UK or US

- 85
- 6
This worked for me with a windows 10 laptop in German, where I wanted i.e. lubridate to return dates in English:
Sys.setlocale("LC_TIME", "English")

- 430
- 5
- 9
Im using R Studio on a Mac and I couldn't find the Rconsole file. So I took a more brutal way and just deleted the unwanted language files from the R app. You just have to go to your Rapp in your application Folder, right click, show package content then /contents/Resources/. There are the language files e.g. English.lproj or in my case de.lproj wich I deleted. After restarting R, error messages appear in English.. Maybe thats helpful!

- 639
- 1
- 7
- 12
you simply have to change the basic language of microsoft on your computer!
press the windows button together with r, and tip the following code into the window that is opened
control.exe /name Microsoft.Language
load the language package you want to use and change the options. but take care, this will change also your keyboard layout!

- 17
- 1
on windows, when you have no admin right, just create a new program shortcut to Rgui.exe. Then in the properties of that shortcut, go to the 'Shortcut' tab and modify the target to include the system language of your choice, e.g. "C:\Program Files\R\R-3.5.3\bin\x64\Rgui.exe" LANGUAGE=en

- 812
- 13
- 16