如何在 Mac 上设置 R 和 Rstudio 的全局默认值?
How to set the global default for R and Rstudio on Mac?
在 Mac OSX 下,对于一般默认值,通常我启动终端并使用 ls -al
检查 .bash_profile 的可用性,然后使用 nano .bash_profile
将必要的全局默认值添加到其中。
但是对于R和Rstudio,如果我想用命令Sys.setlocale(category = "LC_ALL", locale = "zh_cn.utf-8")
设置汉字输入的全局默认值。我使用以下命令获取 R_HOME
R.home()
[1] "/Library/Frameworks/R.framework/Resources"
然后我将命令 Sys.setlocale(category = "LC_ALL", locale = "zh_cn.utf-8")
复制到新创建的名为 .Rprofile 或 "Rprofile.site in the directory "/Library/Frameworks/R.framework/Resources/etc" 的文件中,但它似乎不起作用对我来说,我的步骤有什么问题?
我的问题有一个接近的答案 locate the ".Rprofile" file generating default options
.Rprofile 和 Rprofile.site 有什么区别?
您的问题有点不清楚,但您似乎在要求与配置文件 ~/.bash_profile
等效的内容。那将是 ~/.Rprofile
。有关详细信息,请阅读 “Initialization at Start of an R Session” 上的文档。这也回答了您的问题“.Rprofile 和 Rprofile.site 之间有什么区别?”:
$R_HOME/etc/Rprofile.site
是 站点文件,而 [~/
].Rprofile
是 用户文件.
在 Mac OSX 下,对于一般默认值,通常我启动终端并使用 ls -al
检查 .bash_profile 的可用性,然后使用 nano .bash_profile
将必要的全局默认值添加到其中。
但是对于R和Rstudio,如果我想用命令Sys.setlocale(category = "LC_ALL", locale = "zh_cn.utf-8")
设置汉字输入的全局默认值。我使用以下命令获取 R_HOME
R.home()
[1] "/Library/Frameworks/R.framework/Resources"
然后我将命令 Sys.setlocale(category = "LC_ALL", locale = "zh_cn.utf-8")
复制到新创建的名为 .Rprofile 或 "Rprofile.site in the directory "/Library/Frameworks/R.framework/Resources/etc" 的文件中,但它似乎不起作用对我来说,我的步骤有什么问题?
我的问题有一个接近的答案 locate the ".Rprofile" file generating default options
.Rprofile 和 Rprofile.site 有什么区别?
您的问题有点不清楚,但您似乎在要求与配置文件 ~/.bash_profile
等效的内容。那将是 ~/.Rprofile
。有关详细信息,请阅读 “Initialization at Start of an R Session” 上的文档。这也回答了您的问题“.Rprofile 和 Rprofile.site 之间有什么区别?”:
$R_HOME/etc/Rprofile.site
是 站点文件,而 [~/
].Rprofile
是 用户文件.