2017-10-18 160 views
-1

R是新的。如何访问和编辑Rprofile?如何访问和编辑Rprofile?

下面的帖子没有帮助:How to modify and save Rprofile.site under Windows?

+1

请看[Quick R]中的描述(https://www.statmethods.net/interface/customizing.html) – G5W

+0

谢谢。我搜索了过去的编辑Rprofile,但是我没有点击过名为'customizing StartUp File'https://www.statmethods.net/interface/customizing.html的链接,并且在我的提示中发现它很有帮助。 – Aitch

+0

Rprofile文件位于C:\ Program Files \ R \ R-3.4.1 \ etc中,可通过将其加载到Notepad ++进行编辑。 – Aitch

回答

2

在启动时R将寻找在以下地方的R-简介: (从https://csgillespie.github.io/efficientR/3-3-r-startup.html#rprofile信息)

  1. R_HOME:目录中R已安装。 用R.home()命令找出R_HOME的位置。
  2. HOME,用户的主目录。可以询问R在哪里,path.expand(“〜”)
  3. R的当前工作目录。这由getwd()报告。

注意尽管可能有不同的R-Profile文件,R将只在给定的会话中使用一个。优先顺序是:

当前项目>首页> R_HOME

要创建一个特定的项目,启动脚本创建在项目的根目录.Rprofile文件。

您可以访问和通过

file.edit(file.path("~", ".Rprofile")) # edit .Rprofile in HOME 
file.edit(".Rprofile") # edit project specific .Rprofile  

编辑不同.Rprofile文件有有关选项的信息,您可以设置通过

help("Rprofile") 

正如上面提到的链接不提供额外的细节,但在上面列出的要点应该显示文件的位置以及如何访问它们。