windows R 控制台是我的母语,我如何将 R 设置为英语?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/12760491/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
The R console is in my native language, how can I set R to English?
提问by Superbest
I am using R on Windows 7. Apparently R somehow found evidence that I speak languages besides English, and stubbornly insists on giving output in the console in my own language. For a variety of reasons, this is undesirable, and I want R to be English.
我在 Windows 7 上使用 R。显然 R 以某种方式发现了我说英语以外的语言的证据,并且顽固地坚持在控制台中以我自己的语言提供输出。由于各种原因,这是不可取的,我希望R是英文的。
What works
什么有效
I am able to use LANGUAGE=en
as a command line option for the R console desktop shortcut, but the language is still wrong in Rstudio, which launches the R executable directly and hence ignores the command line arguments in the shortcut.
我可以将其LANGUAGE=en
用作 R 控制台桌面快捷方式的命令行选项,但是 Rstudio 中的语言仍然是错误的,它直接启动 R 可执行文件,因此忽略了快捷方式中的命令行参数。
What doesn't work
什么不起作用
I have tried creating an .Renviron
file under C:\Users\[MY_NAME]\Documents
, which is the path returned for the working directory by getwd()
, with LANGUAGE=en
in it. R ignores this. My R_ENVIRON
and R_ENVIRON_USER
variables show up as ""
so .Renviron
should be the correct filename.
我曾尝试.Renviron
在 下创建一个文件C:\Users\[MY_NAME]\Documents
,这是由 为工作目录返回的路径,其中getwd()
包含LANGUAGE=en
。R忽略了这一点。我R_ENVIRON
和R_ENVIRON_USER
变量显示为""
所以.Renviron
应该是正确的文件名。
I have also tried creating .Renviron
under R_HOME\etc
(R_HOME
points to C:/PROGRA~1/R/R-215~1.0
) and R also ignores it.
我也试过.Renviron
在R_HOME\etc
( R_HOME
points to C:/PROGRA~1/R/R-215~1.0
)下创建,R 也忽略了它。
I was somewhat successful with adding Sys.setenv(LANGUAGE="en")
in R_HOME\etc
- this made all output from the R console English, except for the initial copyright information.
我是有所增加成功Sys.setenv(LANGUAGE="en")
的R_HOME\etc
-这使得从R控制台英语的所有输出,除了初始的版权信息。
The question
问题
How can I make R default to English such that this is propagated to RStudio?
如何使 R 默认为英语,以便将其传播到 RStudio?
采纳答案by Superbest
On a fresh install, adding language = en
to the Rconsole
file (which exists by default under R_HOME\etc
) will make R's language English in the R console as well as RStudio. This can be overridden by code in the working directory and RStudio's individual projects.
在全新安装时,添加language = en
到Rconsole
文件(默认存在于 下R_HOME\etc
)将使 R 控制台和 RStudio 中的 R 语言为英语。这可以被工作目录中的代码和 RStudio 的各个项目覆盖。
回答by mynameisJEFF
First, go to the etc
folder under R program files folder. Then locate Rconsole
file. Find the line language =
, change it to language = en
if you want to run R in English.
首先,转到etc
R程序文件文件夹下的文件夹。然后找到Rconsole
文件。找到这一行language =
,language = en
如果你想用英文运行 R,请将其更改为。
Note: right click on the Rconsole file icon, select Property and grant yourself the permission to modify the file.
注意:右键单击 Rconsole 文件图标,选择属性并授予自己修改文件的权限。
回答by fffchao
it should be the Rconsole file, instead of Rprofile.site.
它应该是 Rconsole 文件,而不是 Rprofile.site。
回答by Darwin PC
The problem is not in R or in RStudio, the problem is in your Windows language configuration.
问题不在于 R 或 RStudio,问题在于您的 Windows 语言配置。
If you are using Windows, you have to set it like this (e.g. Windows 7):
如果您使用的是 Windows,则必须像这样设置(例如 Windows 7):
- Control Panel
Region and language.
2.1. Go to the Tab "Administrative"
- "Language for non-Unicode programs", then set it in the "Change system locale" button.
2.2. If you want, you can set it also the Tab "Format" in Format.
- 控制面板
地区和语言。
2.1. 转到“管理”选项卡
- “非 Unicode 程序的语言”,然后在“更改系统区域设置”按钮中进行设置。
2.2. 如果需要,您还可以在格式中设置选项卡“格式”。
Cheers, Darwin PC
干杯,达尔文电脑
回答by Marco Demaio
Go into R installation directory, i.e.
C:\Program Files\R\
From there go into the subfolder
etc/
Open with a text editor (i.e. Notepad) the file
Rconsole
Look into the file for the line
language =
Replace such line with
language = en
Save and close the
Rconsole
file, then run Rgui again, and the interface will be in English
进入R安装目录,即
C:\Program Files\R\
从那里进入子文件夹
etc/
用文本编辑器(即记事本)打开文件
Rconsole
查看该行的文件
language =
用这样的行替换
language = en
保存并关闭
Rconsole
文件,然后再次运行Rgui,界面为英文
R version 3.1.3
R 版本 3.1.3
回答by Jia Yang
I had the same problem. I solved it by changing my laptop's system preference->region as US. Then, re-install the R. The system language changed ultimately to english.
我有同样的问题。我通过将笔记本电脑的系统首选项-> 区域更改为美国来解决它。然后,重新安装 R。系统语言最终更改为英语。
sessionInfo()
会话信息()
locale: [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
语言环境:[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8