问题描述
我在 Windows 7 上使用 R.显然,R 以某种方式发现了我会说英语以外的其他语言的证据,并且顽固地坚持以我自己的语言在控制台中提供输出.由于各种原因,这是不可取的,我希望 R 是英文的.
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.
我可以使用 LANGUAGE=en
作为 R 控制台桌面快捷方式的命令行选项,但是 Rstudio 中的语言仍然错误,它直接启动 R 可执行文件,因此忽略了命令快捷方式中的行参数.
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.
我尝试在 C:Users[MY_NAME]Documents
下创建一个 .Renviron
文件,这是 为工作目录返回的路径getwd()
,其中包含 LANGUAGE=en
.R忽略了这一点.我的 R_ENVIRON
和 R_ENVIRON_USER
变量显示为 ""
所以 .Renviron
应该是正确的文件名.
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.
我也尝试在 R_HOMEetc
下创建 .Renviron
(R_HOME
指向 C:/PROGRA~1/R/R-215~1.0
) 并且 R 也会忽略它.
I have also tried creating .Renviron
under R_HOMEetc
(R_HOME
points to C:/PROGRA~1/R/R-215~1.0
) and R also ignores it.
我在 R_HOMEetc
中添加 Sys.setenv(LANGUAGE="en")
有点成功 - 这使得 R 控制台的所有输出都是英语,除了初始版权信息.
I was somewhat successful with adding Sys.setenv(LANGUAGE="en")
in R_HOMEetc
- this made all output from the R console English, except for the initial copyright information.
如何将 R 默认设置为英语,以便将其传播到 RStudio?
How can I make R default to English such that this is propagated to RStudio?
推荐答案
在全新安装时,将 language = en
添加到 Rconsole
文件(默认存在于R_HOMEetc
) 将使 R 的语言在 R 控制台和 RStudio 中变为英语.这可以被工作目录和 RStudio 的各个项目中的代码覆盖.
On a fresh install, adding language = en
to the Rconsole
file (which exists by default under R_HOMEetc
) 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.
这篇关于R 控制台是我的母语,如何将 R 设置为英语?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!