以此为例:
> mean(eta)
# [1] NA
# Warning message:
# In mean.default(eta) : l'argomento non è numerico o logico: restituisco NA
> Sys.setenv(LANG = "en")
> mean(eta)
# [1] NA
# Warning message:
# In mean.default(eta) : l'argomento non è numerico o logico: restituisco NA
我的renviron文件仍无法正常工作:
### etc/Renviron. Generated from Renviron.in by configure.
###
### ${R_HOME}/etc/Renviron
###
### Record R system environment variables.
Sys.setenv(LANGUAGE='en')
R_PLATFORM=${R_PLATFORM-'i686-pc-linux-gnu'}
## Default printer paper size: first record if user set R_PAPERSIZE
R_PAPERSIZE_USER=${R_PAPERSIZE-'a4'}
R_PAPERSIZE=${R_PAPERSIZE-'letter'}
## Default print command
R_PRINTCMD=${R_PRINTCMD-'/usr/bin/lpr'}
我认为问题是:
Sys.getenv(LANG)
Errore in Sys.getenv(LANG) : oggetto "LANG" non trovato
此外:
Sys.getenv(LANGUAGE)
Errore in Sys.getenv(LANGUAGE) : oggetto "LANGUAGE" non trovato
此外:
> sessionInfo()
R version 3.0.1 (2013-05-16)
Platform: i686-pc-linux-gnu (32-bit)
locale:
[1] LC_CTYPE=it_IT.UTF-8 LC_NUMERIC=C
[3] LC_TIME=it_IT.UTF-8 LC_COLLATE=it_IT.UTF-8
[5] LC_MONETARY=it_IT.UTF-8 LC_MESSAGES=it_IT.UTF-8
[7] LC_PAPER=C LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=it_IT.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] entropy_1.2.0 ineq_0.2-11 moments_0.13
loaded via a namespace (and not attached):
[1] tools_3.0.1
> system("uname -a")
Linux lucas-K55VD 3.11.0-14-generic #21-Ubuntu SMP Tue Nov 12 17:07:40 UTC 2013 i6
此外:
> 2+x
Errore: oggetto "x" non trovato
> Sys.getenv("LANG")
[1] "it_IT.UTF-8"
> Sys.setenv(LANG='en')
> Sys.getenv("LANG")
[1] "en"
> 2+x
Errore: oggetto "x" non trovato
> Sys.setenv(LANG="en_US-UTF-8")
> 2+x
Errore: oggetto "x" non trovato
> system("locale -a | grep '^en'")
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_COLLATE to default locale: No such file or directory
en_AG
en_AG.utf8
en_AU.utf8
en_BW.utf8
en_CA.utf8
en_DK.utf8
en_GB.utf8
en_HK.utf8
en_IE.utf8
en_IN
en_IN.utf8
en_NG
en_NG.utf8
en_NZ.utf8
en_PH.utf8
en_SG.utf8
en_US.utf8
en_ZA.utf8
en_ZM
en_ZM.utf8
en_ZW.utf8
> Sys.setenv(LANG="en_US.utf8")
> 2+x
Errore: oggetto "x" non trovato
另外一件事:如果stackoverflow阻止我试图显示其他人的代码或控制台输出,我该如何显示R输出或代码?
答案 0 :(得分:3)
请参阅help(Startup)
- 你必须在~/.Renviron
中设置它,以便在主R进程开始之前设置它。
答案 1 :(得分:2)
我能够解决问题的一种方法是在控制台上安装Rstudio并输入:
> Sys.setenv(LANGUAGE="en_US.utf8")
> 2+x
Error: object 'x' not found
在Ubuntu终端输入时,为什么不起作用还没有任何线索。